Mike Chaney's Tech Corner
November 22, 2024, 09:53:39 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Qimage registration expired? New lifetime licenses are only $59.99!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: QImage cannot read (most) of my images  (Read 10128 times)
katzenzakis
Newbie
*
Posts: 4


Email
« on: February 03, 2021, 03:00:39 AM »

I am evaluating QImage, which seems a very capable app. However it cannot read most of my image files. It fails with a "Report zero pixels as height or width" message (see attached). I have also attached XPlorer2 (WinExplorer replacement) view showing it's reading of dimensions etc and view of actual files. The files can be read with no faults by Xplorer2, ImageEye, Photoshop, Paint etc. I cannot find any logs which may indicate the actual reason for failure. Certainly the zero pixels error message is spurious.

My app is FractalCanvas an app written in java which generates PNG files in 24 bit RGB format (using PNGJ library).
Logged
katzenzakis
Newbie
*
Posts: 4


Email
« Reply #1 on: February 03, 2021, 03:01:47 AM »

Here is an example image file
Logged
BrianPrice
Sr. Member
****
Posts: 265



WWW Email
« Reply #2 on: February 05, 2021, 11:04:00 AM »

The file wouldn't open in Photoshop either, see screenshot. It opened in Affinity Designer, and it opened in QI when I re-exported it.
« Last Edit: February 05, 2021, 12:04:40 PM by BrianPrice » Logged
katzenzakis
Newbie
*
Posts: 4


Email
« Reply #3 on: February 08, 2021, 06:49:37 AM »

It opens OK in CS6 but not in the latest version. The "unexpected EOF" may be a clue as to why QImage fails. Resaving files from CS6 is a workaround....
Logged
admin
Administrator
Forum Superhero
*****
Posts: 4220



Email
« Reply #4 on: February 08, 2021, 02:22:41 PM »

I looked at the PNG and there does appear to be some sort of formatting error.  When I read the header to determine things like color space, resolution, etc. there is an error reading the header and the information is not returned.  At that point, I get an empty image so Qimage reports zero pixels in width/height.  I'll see if there is an easy way to work around it and still read the image but there may be nothing I can do as it looks like a corrupted PNG.

Regards,
Mike
Logged
katzenzakis
Newbie
*
Posts: 4


Email
« Reply #5 on: February 09, 2021, 07:07:12 AM »

Thanks for the pointers. I found the problem. In refactoring to use multiple cores, I had moved adding the comment section to after generating the image. Most programs seem to ignore this but some are a little more sensitive. With the comment section back before the image chunks, QImage and the new Photoshop can read all of my files.
Logged
admin
Administrator
Forum Superhero
*****
Posts: 4220



Email
« Reply #6 on: February 09, 2021, 06:59:59 PM »

Sounds good.  I could see how having comments after the image chunks could cause a problem in some apps as that doesn't appear to follow the PNG spec, at least from my quick look at the general specs:

https://en.wikipedia.org/wiki/Portable_Network_Graphics

Looks like all critical and ancillary chunks are supposed to appear in the header... before the image chunks.  Thanks for the followup though.  That would explain why, when I traced the code in Qimage, it looked like some of the header/image reading functions were getting "invalid" data.

Mike
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Security updates 2022 by ddisoftware, Inc.