Just tossing this to the mailing list since I sadly don't have time
or a building gimp13 tree. I expect that the problem is real
but without closer investigation the solution might be a bit dodgy
unless you're sure that this is placd such that we're not going to
use those kludged dimensions subsequently to measure how much data
to unpack, copy, realloc etc.
--Adam
--
Adam D. Moss . ,,^^ adam@xxxxxxxx http://www.foxbox.org/ co:3
busting makes me feel good
'"Wankbadger" failed to reach MPs. "Wank-badger" succeeded.'
--- Begin Message ---
Evidently, it's valid for PhotoShop to export 0x0-sized layers, but it does
export them with actual channel data. I've made a fix locally which makes
those layers do something useful :) What do you think?
Sample output (post-patch):
LAYER RECORD (layer 2)
Layer Width: 0 (replacing with 1)
Layer Height: 0 (replacing with 1)
Layer extents: (0,0) -> (1,1)
Number of channels: 4
CHANNEL LENGTH INFO (0)
Channel TYPE: -1
Channel Data Length: 2
CHANNEL LENGTH INFO (1)
Channel TYPE: 0
Channel Data Length: 2
CHANNEL LENGTH INFO (2)
Channel TYPE: 1
Channel Data Length: 2
CHANNEL LENGTH INFO (3)
Channel TYPE: 2
Channel Data Length: 2
Blend type: PSD("mul ") = GIMP(3)
Layer Opacity: 255
Layer Clipping: 0 (base)
Layer Flags: 40 (don't preserve transparency, not visible)
EXTRA DATA SIZE: 236
LAYER MASK DATA SIZE: 0
LAYER RANGES DATA SIZE: 0
LAYER NAME: 'COLOR ME!! =]'
Patch:
--- plug-ins/common/psd.c.orig Sun Feb 9 17:11:54 2003
+++ plug-ins/common/psd.c Sun Feb 9 17:07:04 2003
@@ -131,7 +131,7 @@
/* *** USER DEFINES *** */
/* set to TRUE if you want debugging, FALSE otherwise */
-#define PSD_DEBUG FALSE
+#define PSD_DEBUG TRUE
/* the max number of layers that this plugin should try to load */
#define MAX_LAYERS 100
@@ -953,7 +953,17 @@
psd_image.layer[layernum].x = left;
psd_image.layer[layernum].y = top;
psd_image.layer[layernum].width = right-left;
+ if (psd_image.layer[layernum].width == 0) {
+ IFDBG printf("\t\t\t\tLayer Width: 0 (replacing with 1)\n");
+ psd_image.layer[layernum].width = 1;
+ right++;
+ }
psd_image.layer[layernum].height = bottom-top;
+ if (psd_image.layer[layernum].height == 0) {
+ IFDBG printf("\t\t\t\tLayer Height: 0 (replacing with 1)\n");
+ psd_image.layer[layernum].height = 1;
+ bottom++;
+ }
IFDBG printf("\t\t\t\tLayer extents: (%d,%d) -> (%d,%d)\n",left,top,right,bottom);
--
Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\
<> green@xxxxxxxxxxx \ The Power to Serve! \
Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\
--- End Message ---