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 172503 - Icon loading problem - top missing
Icon loading problem - top missing
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other Windows
: High normal
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
: 171076 307634 313013 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-04-03 12:22 UTC by Eugen Anghel
Modified: 2008-01-15 12:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a zip containing two icons (107.14 KB, application/x-zip-compressed)
2005-04-03 12:24 UTC, Eugen Anghel
  Details
The screenshot with the problem (35.20 KB, image/jpeg)
2005-04-04 07:29 UTC, Eugen Anghel
  Details
same icon in GIMP on Linux (Ubuntu) and Windows (XP SP2) (108.53 KB, image/png)
2005-05-15 18:13 UTC, Ka Cheung
  Details
Screenshot of reloaded Icon layers (50.07 KB, image/jpeg)
2005-07-12 15:08 UTC, Matthew Carlson
  Details
Top isn't missing anymore (588 bytes, patch)
2006-08-14 14:57 UTC, Aurimas Juška
committed Details | Review

Description Eugen Anghel 2005-04-03 12:22:11 UTC
Distribution/Version: 2003

Please load the icons in the attachement. The top of the icons will be missing. 
In other viewers it is visible, this only happens in GIMP.
Comment 1 Eugen Anghel 2005-04-03 12:24:33 UTC
Created attachment 39629 [details]
a zip containing two icons

use one of this two icons to reproduce the bug
Comment 2 Manish Singh 2005-04-03 16:01:41 UTC
The right to do would've been to attach these to your previous bug report. Now
we have 2 separate bugs with different info.

I'm resolving the other as a duplicate as this one has files to reproduce the
problem.
Comment 3 Manish Singh 2005-04-03 16:02:26 UTC
*** Bug 171076 has been marked as a duplicate of this bug. ***
Comment 4 Manish Singh 2005-04-03 16:21:59 UTC
Loads fine under linux. A screenshot of the resultant image to show what's
missing would help.
Comment 5 Eugen Anghel 2005-04-04 07:29:13 UTC
Created attachment 39666 [details]
The screenshot with the problem
Comment 6 Sven Neumann 2005-04-05 08:36:22 UTC
I cannot reproduce the problem, both files load fine. There are no missing lines
like in your screenshot. Are you certainly using GIMP version 2.2.4?
Comment 7 Eugen Anghel 2005-04-05 12:55:22 UTC
Yes. I actually downloaded GIMP 2.2.4 a few days ago and loaded the file at my 
school. The top was missing, so I don't think it has to do anything with my 
computer. Also, this only happens with some icons, most of them work fine (thank 
you GIMP).

Maybe this is only in the windows version. Are you using the linux one ?
Comment 8 Sven Neumann 2005-04-06 12:47:35 UTC
The source code to read winicon files is the same on all platforms and I even
ran the plug-in in a memory profiler to check for memory corruption or use of
uninitialized values. No problems were detected.
Comment 9 Michael Schumacher 2005-04-06 14:48:13 UTC
I can reproduce this with 2.2.4 on WinXP. Maybe I can research this a bit tonight.
Comment 10 Eugen Anghel 2005-04-09 10:09:27 UTC
Thanks a lot. I'm really looking forward to a new version with this bug fixed.
And please excuse my English.
Comment 11 Sven Neumann 2005-04-09 11:26:17 UTC
Eugen, so far we have no idea whatsoever what could be causing this problem. So
it is unlikely to get fixed anytime soon.
Comment 12 Ka Cheung 2005-05-14 22:47:57 UTC
I have the same problem, especially when opening icon files with multiple layers
(16x16, 24x24, 32x32, 64x64, with alpha channels; some layers would be blank,
and some would be missing top portion)
Comment 13 Ka Cheung 2005-05-15 18:11:46 UTC
Let me add that the same icon opens fine in GIMP on Linux, just not on Windows
Comment 14 Ka Cheung 2005-05-15 18:13:24 UTC
Created attachment 46457 [details]
same icon in GIMP on Linux (Ubuntu) and Windows (XP SP2)
Comment 15 Sven Neumann 2005-06-16 09:00:02 UTC
*** Bug 307634 has been marked as a duplicate of this bug. ***
Comment 16 Matthew Carlson 2005-07-12 15:08:55 UTC
Created attachment 49024 [details]
Screenshot of reloaded Icon layers

I have run into a similar problem with Gimp 2.2.7.  I am running XP SP1.  I
created the icon in question in Gimp, saved it, then reopened it.  Some of the
icon layers came back corrupted, but I think the icon file itself is ok. (Looks
good in Explorer)
Comment 17 Matthew Carlson 2005-07-12 15:15:43 UTC
I forgot some details:
The icon has 8-bit, 4-bit, and 1-bit layers in 64x64, 48x48, 32x32, and 16x16 
sizes.  I've noticed the problem seems to occur on the 8-bit and 4-bit layers 
in particular.  I haven't seen the problem on the 32-bit or 1-bit layers.
Comment 18 steve 2005-07-13 11:42:37 UTC
I have the same ICO loading problem using XP SP2 with Gimp 2.2.7. All layers
load as black (16x16x8 and 16x16x4).
Comment 19 Nick Smith 2005-08-05 08:04:35 UTC
I, too, have this same issue.  It appears as if the top 15 pixels or so are cut
off.  I've swapped the layers in and out repeatedly for possible odd combos and
it seems like some layers, like the third one (icon#3) is blank.  I tried saving
the globe one as an XCF then saving the XCF as a TGA file (saving the XCF as
TGA) but nothing happened - problem still there.
Comment 20 Sven Neumann 2005-08-09 16:14:41 UTC
*** Bug 313013 has been marked as a duplicate of this bug. ***
Comment 21 Michael Schumacher 2005-08-10 14:23:33 UTC
This is definetly something that should be examined before 2.4
Comment 22 Felix Pahl 2006-02-10 17:40:47 UTC
I just reported bug 330692. I don't believe the patches I submitted there will fix this problem, but I'm not sure and thought people working on this bug should be aware of the other one just in case.

By the way, the problem manifests as follows for me (Windows XP, SP 1): The screenshot that someone attached shows what happens for 32-bpp icon files. 1-bpp icon files seem to be OK (apart from the scrambling due to the other bug), but 4-bpp and 8-bpp icon files are loaded as monochrome, even though my investigations into the other bug showed that apart from the local scrambling the RGB colors are being loaded correctly in the winicon.
Comment 23 weskaggs 2006-05-21 18:23:34 UTC
Raising priority to High because this is a serious problem and has turned out to be quite difficult to figure out.
Comment 24 Aurimas Juška 2006-08-14 09:49:01 UTC
The cause of this problem is invalid file open mode. Windows performs some transformations so that windows text files could be modified in the same fashion as Linux text files.

Correction:

in file gimp-2.3.5\plug-ins\winicon\iconload.c (line 133) replace

  if (! (ico->fp = g_fopen (filename, "r")))

with

  if (! (ico->fp = g_fopen (filename, "rb")))

This way file is opened in binary mode and no transformations are made.

File now loads ok. However, preview while opening doesn't seem to use code from the winicon plugin so it still displays the wrong version. I think the same changes must be made there too.
Comment 25 Aurimas Juška 2006-08-14 14:57:08 UTC
Created attachment 70865 [details] [review]
Top isn't missing anymore

Fixed top missing problem - at least for opened documents. Preview code doesn't seem to use the plugin.
Comment 26 Michael Natterer 2006-08-14 15:08:59 UTC
The thumbnail is cached on disk. Look at the thumbnail preview's tooltip
and force it to update the preview.
Comment 27 Sven Neumann 2006-08-14 17:55:46 UTC
Thanks a lot for debugging this. Now fixed in both branches.

2006-08-14  Sven Neumann  <sven@gimp.org>

	* plug-ins/winicon/icoload.c: open the file in binary mode.
	Pointed out by Aurimas Juska; fixes bug #172503.