Imagemagick auto create duplicate file - node.js

I downloaded the icon file from http://www.freeiconsweb.com/favicon.ico. I try to convert ico file to png as below : -
im.convert(['favicon.ico', '-format', '16x16+0+0', 'favicon.png'], function (err, stdout, stderr) {
});
Result :
It's create two png file for me. favicon-0.png and favicon-1.png.
Correct result:
It should be create one file only that is favicon.png.
Anyone know about the why imagemagick create two file ?

An ico file can contain multiple images, a png cannot, so ImageMagick makes a png for each image in the ico file.
From the Wikipedia page (emphasis mine):
The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately.
To get only a single image, you'd have to specify which one you want. For help with that, see the (command line) documentation on reading particular frames of an image.

Related

How to restore whole image from cropped jpg file?

I have jpg file which is cropped for sure from original file.
In osx system I can see small thumbnail preview with whole image.
My question is: is jpg format allow to store whole image, and coordinates that describe how it should be cropped when you open file in any program?
Or is this small thumbnail somehow saved in this file as second resource?
What software do I need to check this? What keywords should I look in order to understand that better?

How is transparent background removed from a TIFF file in Python

I have a situation where I need to convert TIFF files to JPEG files in Python. I am using the PIL library to do this and it works fine unless the TIFF has a transparent background on it and then PIL can't open the file and says it is not recognized. Are there other solutions to this in Python?
TIFF format files usually consist of multiple images of different resolutions. Try reading with openslide
Eg:
patch = openslide.OpenSlide(img_path)
patch = patch.read_region((17800,19500), 0, (256, 256))
For more info visit openslide documentation

How can I create a pixmap based on a .png file?

I have some .png icons I want to use for window buttons in a custom theme I want to create For fluxbox. My operating system is Arch Linux. But, fluxbox works with pixmaps.
Question: Is it possible to create pixmaps based on .png format files?
You can use the program convert from ImageMagick:
xiawi#here:~/Images$ convert lena.png lena.xpm
xiawi#here:~/Images$ file lena.xpm
lena.xpm: X pixmap image, ASCII text, with very long lines

flatten images with transparency in PDF

How to flatten images in PDF files with transparency?
convert PDF to PS (postscript)
pdftops input.pdf output.pdf.ps
If a PDF file contains eg. PNG files with alpha channel (transparency) the PDF is rendered/rasterized to an image and that is not a solution because then you lose the plain text in the file
Is there a tool (linux command line) to flatten images in PDF files with transparency?
Its not clear why you want to do this. If you want PostScript then Ghostscript can produce PostScript for you from a PDF file (use the ps2write device). Obviously transparency will have to be rendered to an image, in which case the resolution is important. The default is 720 dpi which is probably higher than you might need.
Note that a PDF file can't contain a PNG, that's not a possible image type in PDF. A PNG would have to be stored as an image with a separate alpha.

What's an SVG image rendered as PNG?

There's an svg image of Alabama's state flag # http://en.wikipedia.org/wiki/File:Flag_of_Alabama.svg
The caption says "This image rendered as PNG in other sizes." I downloaded the 1,000-pixel size #
http://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Flag_of_Alabama.svg/1000px-Flag_of_Alabama.svg.png but it won't display on my web page. I opened it in Photoshop, copied it into a new window and saved it with a new file name, but it still doesn't display.
So I guess I was wrong when I thought "rendered as a PNG" means an image is a png. It's actually a SVG...with a .png extension?
Anyway, I just wondered what's going on here and what I need to do to download such images as pngs. Or is the only solution to take a screenshot?
The PNG file you linked to (the ".png" link) is not an SVG. It is definitely a PNG.
I don't know why it isn't displaying for you, but it has nothing to do with SVG.
To get the image as .svg just copy the source of the page (of the image) to an editor. Now save it as an .svg image

Resources