Png/Jpg images rendered on linux are stretched on windows #11160

Open
sergiuiscoding opened this Issue Mar 22, 2013 · 7 comments

Comments

Projects
None yet
3 participants
@sergiuiscoding

Tested with phantomjs 1.8.2 on ubuntu 11.04/12.04

phantomjs ../examples/rasterize.js http://google.com google.png

The rendered image looks good on the same linux machine, but seems to have wrong pixel aspect ratio on a windows machine.
If I open the image in an image editor (paint.net, photoshop) the image looks good. So I'm guessing there's some kind of metadata messed-up.

Original image fixed on upload as attachment (or by viewing it in the browser):

google

Print screen with the issue:

print_screen

@sergiuiscoding

This comment has been minimized.

Show comment Hide comment
@sergiuiscoding

sergiuiscoding Mar 22, 2013

Uploading the image as an attachment seems to have corrected the issue.

Uploading the image as an attachment seems to have corrected the issue.

@sergiuiscoding

This comment has been minimized.

Show comment Hide comment
@sergiuiscoding

sergiuiscoding Mar 22, 2013

ImageMagick:

identify -verbose image.png

[...] Properties: date:create: 2013-03-22T11:24:34+02:00 date:modify: 2013-03-22T11:14:45+02:00 png:IHDR.bit-depth-orig : 8 png:IHDR.bit_depth : 8 png:IHDR.color-type-orig : 6 png:IHDR.color_type : 6 (RGBA) png:IHDR.interlace_method: 0 (Not interlaced) png:IHDR.width,height : 652, 600 png:pHYs : x_res=4055, y_res=4331, units=1 png:sRGB : intent=0 (Perceptual Intent)

ImageMagick:

identify -verbose image.png

[...] Properties: date:create: 2013-03-22T11:24:34+02:00 date:modify: 2013-03-22T11:14:45+02:00 png:IHDR.bit-depth-orig : 8 png:IHDR.bit_depth : 8 png:IHDR.color-type-orig : 6 png:IHDR.color_type : 6 (RGBA) png:IHDR.interlace_method: 0 (Not interlaced) png:IHDR.width,height : 652, 600 png:pHYs : x_res=4055, y_res=4331, units=1 png:sRGB : intent=0 (Perceptual Intent)

@JamesMGreene

This comment has been minimized.

Show comment Hide comment
@JamesMGreene

JamesMGreene Mar 22, 2013

Collaborator

I'm assuming those details are from the "stretchy" image. What are the details for it when it isn't stretchy?

Collaborator

JamesMGreene commented Mar 22, 2013

I'm assuming those details are from the "stretchy" image. What are the details for it when it isn't stretchy?

@sergiuiscoding

This comment has been minimized.

Show comment Hide comment
@sergiuiscoding

sergiuiscoding Mar 22, 2013

Details of image rendered with my fix in place (Attn at x_res / y_res):

[...] Properties: date:create: 2013-03-22T15:00:35+02:00 date:modify: 2013-03-22T15:00:33+02:00 png:IHDR.bit-depth-orig : 8 png:IHDR.bit_depth : 8 png:IHDR.color-type-orig : 6 png:IHDR.color_type : 6 (RGBA) png:IHDR.interlace_method: 0 (Not interlaced) png:IHDR.width,height : 604, 600 png:pHYs : x_res=2834, y_res=2834, units=1 png:sRGB : intent=0 (Perceptual Intent)

Details of image rendered with my fix in place (Attn at x_res / y_res):

[...] Properties: date:create: 2013-03-22T15:00:35+02:00 date:modify: 2013-03-22T15:00:33+02:00 png:IHDR.bit-depth-orig : 8 png:IHDR.bit_depth : 8 png:IHDR.color-type-orig : 6 png:IHDR.color_type : 6 (RGBA) png:IHDR.interlace_method: 0 (Not interlaced) png:IHDR.width,height : 604, 600 png:pHYs : x_res=2834, y_res=2834, units=1 png:sRGB : intent=0 (Perceptual Intent)

@ariya

This comment has been minimized.

Show comment Hide comment
@ariya

ariya May 15, 2013

Owner

I finally found out a possible lead.

PNG image writer needs to get horizontal and vertical resolutions. Qt's default horizontal and vertical dpi values are obtained via qt_defaultDpiX() and qt_defaultDpiY() (see src/gui/text/qfont.cpp). For our headless implementation on Linux, apparently some QPlatformScreen settings are either incomplete or incorrect, thus giving a wrong dpi.

Owner

ariya commented May 15, 2013

I finally found out a possible lead.

PNG image writer needs to get horizontal and vertical resolutions. Qt's default horizontal and vertical dpi values are obtained via qt_defaultDpiX() and qt_defaultDpiY() (see src/gui/text/qfont.cpp). For our headless implementation on Linux, apparently some QPlatformScreen settings are either incomplete or incorrect, thus giving a wrong dpi.

@ariya

This comment has been minimized.

Show comment Hide comment
@ariya

ariya May 15, 2013

Owner

@sudosu- Can you try this with 1.9? I think I fixed this already in 3f42fb2 (see issue #10659).

Owner

ariya commented May 15, 2013

@sudosu- Can you try this with 1.9? I think I fixed this already in 3f42fb2 (see issue #10659).

@sergiuiscoding

This comment has been minimized.

Show comment Hide comment
@sergiuiscoding

sergiuiscoding May 20, 2013

@ariya thank you for looking into this. I've just tested with 1.9 and cannot reproduce the issue anymore. The PNG looks good.
So I guess my workaround is not necessary anymore, will switch to the official release.

@ariya thank you for looking into this. I've just tested with 1.9 and cannot reproduce the issue anymore. The PNG looks good.
So I guess my workaround is not necessary anymore, will switch to the official release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment