I'm using ImageMagick with a docker container. My image looks like this.
FROM alpine:latest
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
RUN apk --no-cache add \
imagemagick \
ghostscript \
--update curl
CMD [ "echo", "Use one of the following commands [ animate | compare | composite | conjure | convert | display | identify | import | mogrify | montage | stream ]" ]
The version of ImageMagick is:
Version: ImageMagick 7.0.5-10 Q16 x86_64 2017-06-05 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher HDRI Modules
Delegates (built-in): fontconfig freetype gslib jng jpeg lcms ltdl png ps tiff webp xml zlib
When I run the following command ImageMagick produces a corrupt image.
docker run imagemagick convert -verbose http://www.pdf995.com/samples/pdf.pdf[0] - > foo.jpg
/tmp/magick-1-JjeGtapAEMe1 PNG 612x792 612x792+0+0 8-bit sRGB 60787B 0.020u 0:00.020
/tmp/magick-1et9Ro9BFOGOh PDF 612x792 612x792+0+0 16-bit sRGB 60787B 0.000u 0:00.000
http://www.pdf995.com/samples/pdf.pdf[0]=>pdf.pdf PDF 612x792 612x792+0+0 16-bit sRGB 60787B 0.000u 0:00.000
When I try to open the image it produces I get an error that it's corrupt or damaged?
This is a link to the converted image: https://d26dzxoao6i3hh.cloudfront.net/i ... 3I/foo.jpg
convert pdf generates corrupt image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert pdf generates corrupt image
Using "-" as the output, you are not telling IM what format to use. So IM uses the same as the input format, in this case PDF. You write that to a file called "foo.jpg", but this isn't JPEG format.maqe wrote:convert -verbose http://www.pdf995.com/samples/pdf.pdf[0] - > foo.jpg
The command you want is:
Code: Select all
convert -verbose http://www.pdf995.com/samples/pdf.pdf[0] foo.jpg
snibgo's IM pages: im.snibgo.com
Re: convert pdf generates corrupt image
I use the pipe "-" to output the image to stdout. How can I output to stdout and still tell IM to use jpeg format?
Re: convert pdf generates corrupt image
It seems like jpeg:- works if I want to output the image to stdout. Is it the recommended way to it?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert pdf generates corrupt image
Yes. Prefix the output with the required format, eg:
Code: Select all
convert -verbose http://www.pdf995.com/samples/pdf.pdf[0] JPG:-
snibgo's IM pages: im.snibgo.com