Red and blue dots when converting raw file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
umbo
Posts: 5
Joined: 2018-12-17T09:55:44-07:00
Authentication code: 1152

Red and blue dots when converting raw file

Post by umbo »

Hi guys,

I'm having an issue using the convert command:

Code: Select all

convert input.CR2 output.jpg
The output image has a lot of noise (blue purple and red pixel) where it should be just black.

Any reason for this? What am I doing wrong?

I attach a sample output Image

Thanks for the help,

Umbo
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Red and blue dots when converting raw file

Post by snibgo »

What version of IM? On what platform? What software actually processed the raw data (eg dcraw, libraw, etc)?

The noise in the shadows most likely was created by the camera, perhaps at high ISO, though it could be a bug somewhere. But the noise is very heavy. So, what camera, what ISO, what shutter speed?
snibgo's IM pages: im.snibgo.com
umbo
Posts: 5
Joined: 2018-12-17T09:55:44-07:00
Authentication code: 1152

Re: Red and blue dots when converting raw file

Post by umbo »

Hi snibgo, thanks for the quick reply.

First of all this behavior is happening on this picture as well as my own ones. It does happen on CR2 raw files but it seems not to happen on NEF files.
I downloaded the sample CR2 from http://www.rawsamples.ch/raws/canon/RAW_CANON_6D.CR2 to check if there was a corruption on my CR2 file but it seems to happen also on this one.
When using dcraw the result is similar, but being the result brighter there are less blue and red spots. Those spots seems to be in places where full black should be. I attach the result of dcraw:
https://a.uguu.se/GelhWQoO0iEA_dcraw

The version I'm using is 6.8.9

Code: Select all

Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 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
Platform is Ubuntu 16.04. As per what software, I'm using the `convert` command but I don't know if it uses dcraw or libraw internally, any way to find this out?
Camera Model Name : Canon EOS 6D
ISO : 400
Shutter Speed Value : 1/256

Thanks for the help
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Red and blue dots when converting raw file

Post by snibgo »

Your link to http://www.rawsamples.ch/raws/canon/RAW_CANON_6D.CR2 downloads a 21 MB file RAW_CANON_6D.tiff. This isn't a raw file, which would have a .CR2 extension. It also contains many small circles that have been added to the image somehow.

Your "Delegates" line doesn't contain "raw" or "libraw", so you are not using libraw. If you convert a raw file with "-verbose", IM will probably give you the command line it uses.
snibgo's IM pages: im.snibgo.com
umbo
Posts: 5
Joined: 2018-12-17T09:55:44-07:00
Authentication code: 1152

Re: Red and blue dots when converting raw file

Post by umbo »

Hi snibgo,
the link definitely downloads a CR2 file, as you can check by using the `file` command in linux. The small circle you see are also shown in the output image, but the issue you can see in the first post are the strange blue, red and purple pixel, especially in the top left of the image.

I've run convert with verbose:

Code: Select all

convert -verbose RAW_CANON_6D.CR2 out.tif
"ufraw-batch" --silent --create-id=also --out-type=png --out-depth=16 "--output=/tmp/magick-28861b5oHUOLj6cdr.png" "/tmp/magick-28861AKGJxgZahUSq"
 Found a generic profile, type exif
/tmp/magick-28861b5oHUOLj6cdr.png PNG 3709x5491 3709x5491+0+0 16-bit sRGB 95.25MB 1.890u 0:01.899
RAW_CANON_6D.CR2=>/tmp/magick-28861b5oHUOLj6cdr.png CR2 3709x5491 3709x5491+0+0 16-bit sRGB 95.25MB 0.010u 0:00.010
RAW_CANON_6D.CR2=>out.tif CR2 3709x5491 3709x5491+0+0 16-bit sRGB 98.11MB 7.730u 0:07.780
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Red and blue dots when converting raw file

Post by snibgo »

I downloaded with Firefox, which gave me RAW_CANON_6D.TIFF. Downloading with wget gave me RAW_CANON_6D.CR2, which has exactly the same data. Weird, but that has solved that.

The small circles I noticed seem to be Christmas lights out of focus.

The versions of IM I currently use (v6.9.9-50 and v7.0.7-28) has "raw" as built-in delegates, so they use libraw. "-debug all" confirms they both treat RAW_CANON_6D.CR2 as a DNG file.

The photo is 1/250s f/5.6 ISO 400, with a Canon EOS 6D. I'm not familiar with that camera, but some noise would be reasonable. With dcraw, or IM via libraw, or ufraw-batch v0.19.2, I can't see any noise, and certainly not the bright red pixels shown on the OP.

For example, a crop near bottom-left from IM:
Image

Perhaps the problem is a bug in your version of ufraw-batch. What version are you on? ("ufraw-batch --version")
snibgo's IM pages: im.snibgo.com
umbo
Posts: 5
Joined: 2018-12-17T09:55:44-07:00
Authentication code: 1152

Re: Red and blue dots when converting raw file

Post by umbo »

Ok my version of ufraw is 0.20

Code: Select all

ufraw-batch --version
ufraw-batch 0.20
LCMS 2.x
EXIV2 enabled.
JPEG enabled.
JPEG2000 (libjasper) disabled.
TIFF enabled.
PNG enabled.
FITS disabled.
ZIP enabled.
BZIP2 enabled.
LENSFUN enabled.
So, we have different versions for both imagemagick and ufraw, I guess one of the two is the reason of the noise...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Red and blue dots when converting raw file

Post by snibgo »

You can test ufraw directly, eg:

Code: Select all

ufraw-batch --out-type=png --out-depth=16 --output=rbdots_u.png RAW_CANON_6D.CR2
If that gives red dots, then the problem is ufraw.

If it doesn't give red dots, then try an upgrade of ImageMagick.
snibgo's IM pages: im.snibgo.com
umbo
Posts: 5
Joined: 2018-12-17T09:55:44-07:00
Authentication code: 1152

Re: Red and blue dots when converting raw file

Post by umbo »

Yep it's ufraw creating the dots
Post Reply