librelist archives

« back to archive

Mismatch in behavior in converting PDF to PNG using Wand vs. convert command

Mismatch in behavior in converting PDF to PNG using Wand vs. convert command

From:
Jeff Tchang
Date:
2013-10-11 @ 22:43
Running this command works perfectly:

convert -identify -resize 750x750 -density 300x300 test.pdf test.png
test.pdf PDF 2400x2400 2400x2400+0+0 16-bit DirectClass 16.48MiB 0.440u
0:00.059

This code inside Python prints out very weird width and height:

        with Image(blob=pdf_binary, resolution=(300,300)) as img:
            print img.size
            img.resize(750, 750)
            return img.make_blob(format="png")

This prints out (595L, 842L) as the width and height (I expect it to be
square).
Resize does not work properly.

Anyone have any ideas?

-Jeff

Re: Mismatch in behavior in converting PDF to PNG using Wand vs. convert command

From:
Jeff Tchang
Date:
2013-10-12 @ 00:23
Figures after mailing the list I'd solve it. I had mistakenly forgot that
when I generated the file test.pdf it was different than the binary stream.
I thought it was the same but when I printed the byte counts it was
different.


On Fri, Oct 11, 2013 at 3:43 PM, Jeff Tchang <jeff.tchang@gmail.com> wrote:

> Running this command works perfectly:
>
> convert -identify -resize 750x750 -density 300x300 test.pdf test.png
> test.pdf PDF 2400x2400 2400x2400+0+0 16-bit DirectClass 16.48MiB 0.440u
> 0:00.059
>
> This code inside Python prints out very weird width and height:
>
>         with Image(blob=pdf_binary, resolution=(300,300)) as img:
>             print img.size
>             img.resize(750, 750)
>             return img.make_blob(format="png")
>
> This prints out (595L, 842L) as the width and height (I expect it to be
> square).
> Resize does not work properly.
>
> Anyone have any ideas?
>
> -Jeff
>
>