After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658610 - Warn when importing PNG images with an offset
Warn when importing PNG images with an offset
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.6.11
Other All
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 568835 691398 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-09-08 22:24 UTC by Hadmut Danisch
Modified: 2013-01-09 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PNG offsets dialog (3.96 KB, patch)
2012-02-09 18:22 UTC, Ville Sokk
none Details | Review

Description Hadmut Danisch 2011-09-08 22:24:08 UTC
Hi,

I just found that gimp (Ubuntu 11.04 and 11.10) does not read a png file correctly, there is something missing at the bottom (or the content seems to be shifted downwards, since there seems to be a transparent part above the image). 

I am not sure wether the problem is in gimp itself or a png library. However, both eog and gimp use the same libpng12.so , and eog works correctly. 

Fetch the example file from  http://www.danisch.de/tmp/in.png

regards
Hadmut
Comment 1 Martin Nordholts 2011-09-09 04:53:02 UTC
That's because the PNG file has an y offset of 279:

$ identify ~/Desktop/in.png 
/home/martin/Desktop/in.png PNG 4566x1141 4566x1141+0+279 8-bit DirectClass 12.1MB 0.000u 0:00.000

Note 279 in 4566x1141+0+279.

You're not the first one confused by this. IMO we should add a dialog when importing offsetted PNG images that says something like:

The PNG image you are importing have a specified offset of x = 0, y = 279. Do you want to apply this offset to the layer?

[Apply PNG offset to layer] [Ignore PNG offset]

Unless there are objections I will do this soonish.
Comment 2 Michael Natterer 2011-09-09 06:24:12 UTC
Absolutely no objections.
Comment 3 Raphaël Quinet 2011-09-09 09:20:34 UTC
It would also be nice to add this after the apply/ignore buttons:
 [X] Remember this decision for other PNG images
or "Do not ask again"
Comment 4 Michael Natterer 2011-09-09 11:12:50 UTC
Yes that would be nice, but we really can't have such checboxes in plugins
until we have a way to manage such persistently stored plugin settings.
Otherwise the checkbox will be hidden for good unless you rm ~/.gimp
Comment 5 Michael Schumacher 2011-09-09 13:33:26 UTC
Wouldn't a nice solution be something like adding the png offset to the layer as a parasite and adding UI to point out where a newly added layer (or the active layer) is located if it isn't shown in the visible part of the image window?

This could also include a way to disregard the offset and move it into the currently visible part.

Oh, and we should make sure to research why there are images with offsets even if the people using them don't suspect that- i.e. what created those images.
Comment 6 Martin Nordholts 2011-09-10 14:44:17 UTC
Actually, this is a perfect thing to give to someone that says "I am a programmer and want to help but I don't know with what". Setting gnome-love keyword.
Comment 7 Martin Nordholts 2012-01-09 18:39:21 UTC
*** Bug 568835 has been marked as a duplicate of this bug. ***
Comment 8 Lavakesh Pandey 2012-02-09 04:52:51 UTC
where can I get the source code of this file so that I can work for patch. I am a student/programmer and I want to work for its fix. Since Martin Nordholts has already said it's easier for new comers so I think it would be great to work on this bug.
Comment 9 Michael Natterer 2012-02-09 08:32:39 UTC
git clone git://git.gnome.org/gimp
Comment 10 Ville Sokk 2012-02-09 18:22:57 UTC
Created attachment 207206 [details] [review]
PNG offsets dialog
Comment 11 Ville Sokk 2012-02-09 18:25:55 UTC
Sorry, I'm new to Bugzilla. I wanted to comment on the patch. I haven't produced a patch with git before, so I hope it works. Also, RUN-NONINTERACTIVE should still apply the offset.
Comment 12 Michael Natterer 2012-02-12 19:11:17 UTC
Thanks, that patch looks really good for a first one, in fact it's almost
perfect. Will push with some minor changes.
Comment 13 Michael Natterer 2012-02-12 19:50:50 UTC
Fixed in master:

commit f07b9606d833fe36009653be4fc2ae558efa23ad
Author: Ville Sokk <embassyhill@gmail.com>
Date:   Thu Feb 9 20:09:14 2012 +0200

    Bug 658610 - Warn when importing PNG images with an offse
    
    Added a dialog about offsets to the PNG loader

 plug-ins/common/file-png.c |   87 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 80 insertions(+), 7 deletions(-)

commit ddb1f968b5355bc94db5d279ff76e207998353cf
Author: Michael Natterer <mitch@gimp.org>
Date:   Sun Feb 12 18:41:52 2012 +0100
Comment 14 Alexia Death 2013-01-09 13:22:45 UTC
*** Bug 691398 has been marked as a duplicate of this bug. ***