AR face database : The original conversion of .raw files into other format - image

I have successfully downloaded and unzipped the .raw files from the set. But i am having problem with the convert command
$convert -size 768X576 -depth 8 -interlace plane rgb:m-001-1.raw m-001-1.bmp
As i am converting it is giving yellowish background image as seen in photo. But the image in AR face database with RGB format have white background.
Can anyone tell what is the problem?
the photo in raw format in database is of 24 bit depth.

The fact that the face is recognisable in its form indicates that you have the sizes and bit-depth and interlace correct.
The fact that it is yellow when it should be white indicates that the blue channel is "unhappy". If you delete the current blue channel, and duplicate the red channel and use that as blue, it comes out presumably closer to the original:
convert http://i.stack.imgur.com/knQkT.png -separate -delete 2 -clone 0 -combine result.png
My guess is that you have an old ImageMagick version and that you should probably avoid BMP format - maybe consider using NetPBM's PAM format instead - as it is easier to process.
NetPBM format link
To check your IM version use,
identify -version
Version: ImageMagick 6.9.2-4 Q16 x86_64 2015-10-29 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC

Related

ImageMagick adds thick horizontal lines to PNGs extracted from PDF

Edit July 7, 2017: Downgrading to ImageMagick 6.9.5 solved this problem, which may be Cygwin-specific. I still don't know the underlying cause.
I need to extract data via OCR from images in PDF reports published by Chicago Public Schools. An example PDF is here (NB: this link downloads the file automatically rather than opening it in the browser). Here's a sample image (from PDF page 11, print page 8), extracted with pdfimages -png version 0.52.0 on Cygwin:
I'd like to crop each bar into its own file and extract the text with OCR. But when I try this with ImageMagick (version 7.0.4-5 Q16 x86_64 2017-01-25 according to convert -version), using the command convert chart.png -crop 320x600+0+0 bar.png, I get this image, with horizontal lines that interfere with OCR:
Running pdfimages to extract to PPM format first and then converting to PNG while cropping gives the same result, as does round-trip converting the extracted images to SVG format with ImageMagick's rsvg delegate, and fiddling with the PNG alpha channel changes the line's colors from gray to white or black but doesn't eliminate them. I've found a workaround of round-trip converting extracted images through JPG (introducing ringing artifacts, which I hope are irrelevant). But I don't see why I should have to do this. Incidentally, ImageMagick introduces the lines to PNGs even if I run a null conversion convert chart.png chart.png, which ought to leave the image unchanged:
I have found other complaints that PDF software adds horizontal lines to images, but none of them exactly matches this problem. A discussion thread mentions that versions of the PDF standard somehow differ in their treatment of alpha channels, but my knowledge of graphics is too poor understand the discussion fully; besides, my images get horizontal lines added after they're extracted from the PDF, because of something internal to ImageMagick. Can anyone shed some light on the causes of the grey lines?
Using the latest ImageMagick 7.0.6.0 Q16 Mac OS X, I get a good result. As mentioned above by Bonzo, the correct syntax for IM 7 is magick rather than convert. The use of convert reverts to IM 6. Also do not use magick convert either.
magick chart.png -crop 320x600+0+0 +repage bar.png
If this does not work for you, then there must have been a bug in your older version of IM 7. So you should then upgrade.
Note also the +repage is needed to remove the virtual canvas

Remove meta information in picture using "convert" without changing the colors of the picture

I have a problem using the tool convert (imagemagick) to remove metainformation of pictures to make them smaller for faster delivery in websites.
When I use the convert command with following parameters:
convert -format png -strip pic1.png pic2.png
then the converted picture is much more darker than the original one.
I also tried to require the colorspace of the original picture with:
convert -format png -colorspace sRGB -strip pic1.png pic2.png
but it's the same problem.
Has anyone an idea how to solve it?
These are the example pictures:
(Original) Pic1:
(Converted) Pic 2:
The problem is the installed version 6.7.7 of ImageMagick (Standard-Version of Linux Mint 17)
In version 6.4 and (said in comment) in version 6.9 it works.
So the 6.7.7 version is buggy in that case.

Transparent PNG created in Imagemagick drawn as opaque in FFMPEG

I am trying to script the creation of videos using ImageMagick to create some overlays which are then placed on top of a video.
If I try to use the image created by ImageMagick directly the transparency is drawn as opaque.
I have created a transparent PNG using ImageMagick draw commands. When loaded into GIMP and examined, the PNG has an alpha channel and each transparent pixel appears to have transparency: RGBA = 0,0,0,0
This image when then used as an overlay in ffmpeg just has an opaque black background in the video.
If I export the image again from GIMP then the file looks identical, but in the video just appears as a solid blue (the colour of the drawings in the overlay image).
I can fix this by taking the overlay image, loading it in GIMP and then selecting all and creating a new image from the clipboard and exporting that (using exactly the same settings as when I re-exported before without creating a new file) and it will then work exactly as desired, showing the non-transparent portions of the overlay and not showing transparent parts.
KEY QUESTION:
How can I either script the conversion that somehow occurs when creating a new file in GIMP, or (much better) not have it go wrong in the first place?
Here are the two files:
BROKEN:
WORKS:
What is the difference?
I suggest you prefix the output filename when using ImageMagick with PNG32: to force it to generate a 32-bit ber pixel image - i.e. 1 byte each for R, G, B and Alpha and hope that ffmpeg is happier with that.
convert input.png -draw ... PNG32:output.png
If you run identify -verbose (also in the ImageMagick suite) on your broken and your working images, you will see that the primary difference is that the working image has color-type=6 and bit-depth=8 whereas the broken image has color-type=3 (indexed) and bit-depth=4

Ghostscript - don't show objects with overprint set

I'm trying to convert preview pdfs uploaded by converting them to jpeg. Please can someone tell me how I can preview overprint? i.e. if a white object is set to overprint over a coloured background it shouldn't be shown - we only see the background.
/c 'C:\Program Files\gs\gs9.10\bin\gswin64c.exe' -o image%04d.jpg -sDEVICE=jpeg -dJPEGQ=60 -r150 -dSimulateOverprint=false -dUseCropBox uploaded.pdf
Also how can I output/list the created files?
Thanks
Overprint is only defined for CMYK inks, so you need to run to a device which support CMYK output. If you go to gray or RGB then the CMYK values are converted to RGB and will no longer overprint.
Try the tiff32nc device. Or jpegcmyk if you really want to use jpeg.

Preferred library and/or method of converting CMYK to RGB

Each month I get new CMYK and RGB images that shall be used on the web.
I had a script using a patched up ImageMagick doing this, but it got deleted. So I need to do it again, but it was hard last time.
How do you easily and quickly convert CMYK image files to RGB?
Like so:
convert CMYK.tiff -profile "RGB.icc" RGB.tiff
convert cmyk_image.jpg -colorspace
rgb rgb_image.jpg
The answer of g.b.1981 basically is correct (+1), but...
To make it work reliable, I found I had to add -type truecolor to the commandline:
convert cmyk.jpg -colorspace rgb -type truecolor rgb.jpg

Resources