Sorry it took me a while to get to this, but I have the first part of the 
solution here: https://github.com/OpenImageIO/oiio/pull/3806 
<https://github.com/OpenImageIO/oiio/pull/3806>
This solves an issue where PSD files wider than 64k pixels per scanline would 
simply not correctly decode rle-compressed data. It was simply a case of a 
couple parameters declared as 16 bit data types that should have been 32 bits. 
I can't fathom why it was done that way, I think it was just a mistake that was 
never caught.

This allows iconvert, etc, to successfully copy the file, though it still uses 
a lot of memory.

I see now that the psd reader ALSO uses way too much memory, hanging onto 
memory it doesn't need to. I will try to address that separately. But at least 
now it works, if you have enough memory in the machine.


> On Mar 21, 2023, at 11:45 AM, Jens Olsson 
> <jens.gustaf.johan.ols...@gmail.com> wrote:
> 
> Hi,
> (Gmail seems to bounce the mailing list e-mails, so I'm doing a manual 
> copy/paste reply from the archive)
> > I don't know what's going on with the "unable to decode", that's where 
> > repro is vital.
> 
> I sent the actual repro psb to security at openimageio.org 
> <http://openimageio.org/>. I couldn't manage to repro it with a constant 
> colored psb of the same size.
> 
> > I'm not sure about the crashes, either, unless those are simply cases of 
> > running out of memory.
> 
> > High memory use: I'll need to know exactly what command line arguments 
> > you're using so I can see what operations you're trying to do. In general, 
> > maketx needs to hold the whole image in memory to do the down-size to get 
> > subsequent MIP levels. I'm sure it could be changed to operate chunk by 
> > chunk for the big image case. But also, there may be command line arguments 
> > you're using, or not using, that could help.
> 
> I was using:
> maketx -oiio input.psb -o out.tif
> oiiotool input.psb -otex out.tif
> iconvert input.psb out.tif
> 
> In code I tried both InputImage/OutputImage looping over scanlines and 
> reading/writing directly but result seemed garbled when I got it to process.
> I also tried ImageCache with autotile = 64 x 64, but result was constant 
> colored gray when I actually got something to process.
> 
> > I'm not aware of any specific problems with the PSB/PSD reader, but on the 
> > other hand, I'm not sure how often it's used for images that big, or if 
> > there is anything specific about your images that's making it hit some kind 
> > of edge case.
> 
> > By any chance, are you able to make a file you can send me that exhibits 
> > these problems so I can easily reproduce it on my end and see what's going 
> > on? It doesn't need to have "real content" -- if you can get a solid color, 
> > checkerboard, or gradient to be problematic, that's even better as far as 
> > I'm concerned. 
> 
> >     -- lg
> 
> Hope that helps! Happy to get you more info if there's something I missed.
> 
> Best regards,
> Jens
> 
> > > On Mar 20, 2023, at 1:56 PM, Jens Olsson <jens.gustaf.johan.olsson at 
> > > gmail.com 
> > > <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>> 
> > > wrote:
> > > 
> > > Hi!
> > > I was trying to read some really big PSBs to do some calculations on, but 
> > > not having much luck when the file gets too big. The example I have is 
> > > 85K x 100K.
> > > 1. maketx and oiiotool crashes with segmentation fault
> > > 2. iconvert exits with the error
> > > "unable to decode packbits"
> > > 
> > > I managed to read/write scanline by scanline with ImageInput/ImageOutput 
> > > while hacking madly, but the end result looked incorrect, like data had 
> > > been teared or offset somehow.
> > > 
> > > The memory load is pretty damn high as well, is it trying to read all of 
> > > the image data into memory? I would think that by reading scanlines it 
> > > wouldn't need to hold that much in memory.
> > > 
> > > Any hints on how to best read PSB are greatly appreciated, I'm resorting 
> > > to convert from PSB to tif with ImageMagick now before reading that 
> > > through OIIO, but would prefer to read them directly since it quickly 
> > > eats up storage. Are there known limitations with the PSB reader?
> > > 
> > > Best regards,
> > > Jens
> > > _______________________________________________
> > > Oiio-dev mailing list
> > > Oiio-dev at lists.openimageio.org 
> > > <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
> > > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
> > > <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
> 
> > --
> > Larry Gritz
> > lg at larrygritz.com 
> > <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>_______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
l...@larrygritz.com





_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to