When I try to pass a jpeg which have exif rotation as 90 and try to resize my resize image gets corrupted. The fix for now is passing the image as a file and reading the output also as file. Currently I am reading and writing the bytes from stdin and stdout directly from my Java processBuilder.
Does anyone know why this problem occurs?
gm convert -limit threads 4 -limit Memory 512M -limit Map 1024M -limit Disk 1024M -size 2048x1458 - -flatten -sharpen 1.00x0.95 -rotate 90 -scale '2048x2048>' +profile !icm,* -interlace None -type TrueColor -quality 93 -sampling-factor 1x1 jpeg:-
UPDATE: This has nothing to do with rotation. The problem is since the jpegs have some trailer in the end of the file.
......... JPEG RST7 JPEG RST0 JPEG EOI Samsung trailer (129 bytes at offset 0x1ba3ed):
gm identify gives below result
rotate_1_37658078940_605a46_o.jpg JPEG 2592x1944+0+0 DirectClass 8-bit 1.7M 0.000u 0:01
gm identify: Invalid SOS parameters for sequential JPEG (rotate_1_37658078940_605a46_o.jpg).
There is no problem with Graphics Magick convert. The redirectError stream was set to true due to which the stderr was clubbed with stdout(bytes).