Fits file does not seem to be read correctly

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
universalmaster
Posts: 3
Joined: 2016-12-10T04:39:16-07:00
Authentication code: 1151

Fits file does not seem to be read correctly

Post by universalmaster »

Hi!

If I convert a fits file which is underexposed, I get strange values for the mean in the red channel:

$ convert test.fits -format "%[mean]\n" info:
35317.5
2984.76
4756.72

The image should have the highest mean in the blue channel. Pixinsight report the following "8-bit" means
mean 9.6 11.9 18.9
Iris (http://www.astrosurf.com/buil/iris/) report the same values as Pixinsight, so it is two agains one :lol:

The ratios between the blue and green channels agree with the ratio from pixinsight and iris, but the red is way off. If I do the same for another fits image (which is overexposed), the values match pretty well.

Here is the image https://drive.google.com/file/d/0B182-t ... sp=sharing

Here is my version:
pi@observatory:~ $ convert --version
Version: ImageMagick 6.8.9-9 Q16 arm 2016-11-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

Best Regards,
U
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Fits file does not seem to be read correctly

Post by dlemstra »

It looks like your fits image contains multiple images. 3 to be exact and you are getting the mean for the 3 images that are grayscale. You can see the different images when you convert the image to a png: convert test.fits test.png
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
universalmaster
Posts: 3
Joined: 2016-12-10T04:39:16-07:00
Authentication code: 1151

Re: Fits file does not seem to be read correctly

Post by universalmaster »

Yes, exactly. But the red image (1st gray scale image in the file) and mean of the red image comes out all wrong with imagemagick but not with other programs. The mean of the 1st image should be about half of the mean of the 3rd image (the blue channel) in the file.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Fits file does not seem to be read correctly

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
universalmaster
Posts: 3
Joined: 2016-12-10T04:39:16-07:00
Authentication code: 1151

Re: Fits file does not seem to be read correctly

Post by universalmaster »

Excellent, that was fast!

Thanks for the great software :-)
Post Reply