Problem with convert JPG from stdin

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
anubisza
Posts: 1
Joined: 2011-03-29T14:25:33-07:00
Authentication code: 8675308

Problem with convert JPG from stdin

Post by anubisza »

Hi,

I am having trouble when using convert on a JPEG image from stdin. Other image types (PNG, GIF) work correctly.

More detail:
I have created a Java application that calls convert using this command: convert <type>:- <args> <type>:-
The Java app then writes image bytes to stdin and reads converted image bytes from stdout.

The application works as expected in the following case:
convert png:- -resize 50x50 jpg:-
The command is called, PNG bytes are written to stdin, resized JPG bytes are read from stdout. Yay.

The problem occurs when trying to give JPG input:
convert jpg:- -resize 50x50 jpg:-
The command is called, JPG bytes are written to stdin but convert never writes anything to stdout. :'(
I am 100% certain that the bytes written to stdin are a complete, working JPEG image. They even have expected magic bytes.

Things I have tried:
- Using "jpeg" instead of "jpg" in convert command: convert jpeg:- -resize 50x50! jpeg:-. This did not help.
- I figured that convert may be waiting for the 0xFF, 0xD9 to signal the end of a JPG. I write those bytes to stdin after the image bytes. Did not work.

My convert -version:
Version: ImageMagick 6.6.7-5 2011-02-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL

I am out of ideas and I would appreciate if anyone could offer some help and/or suggestions.

Thanks for making one of the best image tools on the planet.
Post Reply