Optimize size of DZI rendered - imagemagick

I am currently testing magickSlicer for converting large jpeg files to DZI. It works nice.
However, i am facing a problem with the size of rendered DZI. For exemple, for an orginal jpeg file weighting 10Mo, the rendred DZI folder weight 26.2Mo with default option (-w 256 -h 256).
If I change options width and height to 512x512 the DZI folder weight 18.3Mo. It is yet too big because I have to deal with a huge repository of large files.
I wish to know how can I manage options of conversion for getting a DZI folder weighting less or equals to the weight of original files.
Best regards.

You might be able to change the image quality (to make the JPEG files smaller) by playing with the --options command line argument:
https://github.com/VoidVolker/MagickSlicer#--p---options-imagemagick-options-string-
You'll have to look at the ImageMagick command line options to find the right value:
http://imagemagick.org/script/command-line-processing.php#option
That said, because DZI contains a pyramid of tiles, you are making more pixels than you started with. To be precise, you're ending up with 1.333 times as many pixels. All other things (like image quality settings) being equal, for your 10MB file you should end up with a 13MB set of tiles.

Related

Gimp exports: Why is the image size increased?

I'm trying to use a two step process of employing Gimp to delete sections of images and then using Inkscape for the remainder of the image work.
Unfortunately, I'm seeing a resolution change when doing the export to PNG from Gimp.
The exported image is around 50% larger than the original, which impacts the quality.
Is there a way to keep the resolution constant when exporting the file?
Hopefully I'm just forgetting something, since I've spent some time away from image work.
Please let me know if any additional info is required.
In the interim, I'll try another tool to do the Gimp step.
THANKS!
Edit: Updated size to resolution.
For a bitmap/raster image, resolution (for Gimp: "Image print resolution", see Image>Print size) is indicative. The only thing that counts is the size in pixels.
If you have image window set to "Dot for Dot" (Edit>Preferences>Image Windows->General>"Use dot for dot" or View>Dot for dot) the image is displayed with the definition of your screen (around 100PPI fore regular screens, 20OPPI for high def ones (Retina, etc...).
When you create the image (File>New...), you can specify a print definition and a print size, and Gimp will compute the required size in pixels.

Optimize storage of large number of .PNG files

I have milions of .PNG images which all have same colors. I would like to use this knowledge in order to save some space in following manner: Force all files to use same palette and store only IHDR and IDAT section and use same PLTE for all files. I would then inject PLTE when image is requested. As this is not trivial i am asking is this is sound approach? Is there some obstacle that i missed? Is there another approach for this problem? Initial observation is that this would save ~15% of storage.
Examle how much space is saved for single image if PLTE section is not storred:
Encode your images in grayscale format (instead of pal indexed). Keep your palette in single separate file.
On image request change fromat back to indexed palette and inject palette entries.
That looks a cost too high (developing a software to store and rebuild invalid PNG files) to gain too little. It sounds also strange that you have "millions" of images with the "same colours" - what does the later mean? do they really have the same palette (up to 256 colors)? If to "force a common palette" you have to sacrifice quality, wouldn't be more efficient to store them in JPEG.
Also, the images must be quite small if stripping the palette gives you 15% of gain. In that case, a more practical approach (especially if the files have the same size, in pixels) would be to store groups of them tiled together in a single PNG image, similar as CSS sprites.

Tilemap gets messed up when converted to hd

I have a floorplan that I need to turn into a tilemap. I'm using the program HD2x to convert my tilemap into an -hd tilemap. I tried it in different ways:
1)I converted the floorplan into a -hd .png with HD2x, and then put this into Tiled, and the saved it and converted the final .tmx file into -hd. I then put the -hd tmx and -hd png file into x-code.
2)I put the regular floorplan into tmx, and then converted this into -hd and converted the floorplan.png into -hd, then put these into x-code.
These aren't working.. either the tilemap is half the size it should be, or it's a QUARTER of the size it should be and the floorplan looks messed up.
Please help.
Original Comment
You might be using the program wrong. It doesn't make sense that a tool would take an SD image and make it HD. Most likely it is meant to take an HD image and cut its resolution in half for the SD version.
Answer
It seems like you are creating images that are half the size of the original, but you are expecting it to do the opposite. In general you wouldn't want to go from SD to HD by simply increasing the image's resolution because the quality would drop. Taking an image and simply doubling its size will not look good.
But quality aside it wouldn't make sense for someone to create an application that increases your resolution for you by simply doubling its size. If that specific application you are using has that as an option, you are likely not setting the right option. From the sounds of it the application is creating images half the size of the images you are feeding it. That is likely the reason why you are getting half or a quarter of the expected size.

How to analyze ios ipa files info for reduce file size?

I want to reduce compiled file size of ios ipa file.
I get "How to reduce" way: How to reduce the size of my iPhone application?
But I want to know "How to analyze" way:
My image is
$ du /path/to/app
100 /path/to/app/images
150 /path/to/app/sounds
And I wan to reduce file size on effective point. Visualization is more good!:
http://www.lomont.org/Software/Utilities/DiskInfo/DiskInfo.png
I know I should delete files which is not used but is linked project...
I have used a tool called [ImageOptim] (http://imageoptim.com/xcode.html)
It incorporates a number of tools inside which crush your png files significantly (in my case it was between 25% to 50%) and had reduced the size of my app of around 0.6 mb
One thing to remember is to disable Xcode's PNG optimization.
There is no magic way to reduce the file size of ipa file.
What you can do to reduce the size are just as you said,
Remove any unnecessary files
If you have a lot of images, consider using PNGCRUSH to reduce file size of images
If you have a lot of sound files, consider using compressed audio file such as MP3, also, consider changing to mono instead of stereo. Bit rates of around 96K is still pretty decent.

Why '.png' files produced by ImageMagick are so much bigger than '.jpg' & '.gif' files? [duplicate]

This question already has answers here:
What are the different usecases of PNG vs. GIF vs. JPEG vs. SVG? [closed]
(14 answers)
Closed 9 years ago.
I'm using ImageMagick to convert some files from one format to another. I was always under the impression that .png files were supposed to be as big/small as .jpg if not smaller, and definitely smaller than .gif.
However when I run
convert photo.jpg photo.png
The files I'm getting out is about 6 times bigger than the original jpg.
Original jpg is a regular photo about 300x500 px, 52 kb. Output is a proper png of the same dimensions, but size is about 307 kb?
Does anyoone know what the hack is going on? Am I doing something wrong?
P.S.:
I tried both on Debian and Windows with the same results.
P.P.S.:
Also when I add resize option to this and resize to 10000 x 10000. Converting and resizing to jpg takes a few seconds, but it works, if I do the same of png, I jsut strt running out of memory altogether
P.P.P.S.:
For people who keep marking this question as duplicate of PNG vs. GIF vs. JPEG vs. SVG - When best to use? . Please read carefully and understand the question. It's not a duplicate, since this question asks' about files produced programmatically with specific application (image magick). The question you marking as duplicate, is asking which image format is better to use on the web. Two DIFFERENT questions.
The key thing to note here is that each image file format is best for specific purposes.
JPEG stands for “Joint Photographic Experts Group.” That right there should tell you that the .JPG file format is optimized for photographs. It doesn’t work so well for line-art, logos, gradient or tiled / patterned backgrounds, and the like. .JPG’s DCT (Discreet Cosine Transform) artifacts (the “blocky” artifacts we all know and loathe) are much more noticeable with line art and logos than with photos.
PNG has replaced GIF for everything that GIF was ever good for, except one, and that only because no clear standard has emerged: animations. Animated .GIFs are well known on the Web. There are two competing standards for animated .PNGs: APNG and MNG.
APNG is supported in most modern browsers, and is also fully backwards compatible (the file extension is .PNG, not .APNG, and if any program that can display .PNGs but doesn’t know APNG is “fed” an APNG, it will display either a stand-in image of the developer’s choice, or the first frame of the animation if no such stand-in was provided — as far as the older program is concerned, it’s just an ordinary single-frame .PNG with that one image in it — the rest is safely ignored). Gecko (FF, etc.) and Presto (Opera) support it natively, and Google Chrome (using Webkit) can with an add-on.
MNG has the backing of the actual PNG-format development team, but is its own format and is not backwards compatible, but is more powerful and flexible. Right now, only KHTML-based browsers (Konquerer) support it: not Trident (IE), Gecko, Webkit (Chrome, Chromium, Safari), nor Presto.
PNG does everything (except animations unless enhanced with APNG) that GIF does, and better. All else being equal, a .PNG will almost always be smaller than a .GIF at the same resolution and bit depth. Like .GIF, .PNG can support color depths up to 8 bits per pixel in indexed-color (paletted) mode, but unlike .GIF (yet like .JPEG) it also supports direct-color mode at 24 bits per pixel.
In either mode it can add 8 bits of alpha transparency, unlike .GIF (which can only do indexed color transparency [pick a color out of the palette to be replaced with 100% transparency, aka invisibility] — .PNG can do that, too). Alpha transparency produces much better results than indexed transparency, because the pixels can be partially transparent, whereas with indexed transparency (the only kind available in .GIF) your choices are either opaque or invisible. This makes for “halos” around non-rectangular objects when placed against background colors other than the one the .GIF or indexed .PNG was originally “matted” against. It also inhibits being able to do effects such as glows, drop shadows, and, of course, see-through colored objects (without dithering). Alpha transparency can do all of those things with ease, against almost any background (glows would be largely invisible on a white background, and drop shadows would be invisible on black, but you know what I mean).
Yes, you can do 8-bit alpha transparency in an indexed-color .PNG! And guess what? Even Microsoft Internet Explorer 6 can display those just fine, complete with transparency! It’s only the 32-bit .PNGs (24-bit RGB color + 8-bit alpha) that IE6 choked on and displayed as gray!
The most well-known program that can export PNG8 (indexed color) with alpha transparency is Adobe (formerly Macromedia) Fireworks. The Photoshop “Save for Web and Devices” (at least as of CS3) could not do that, despite having basically lifted the feature from Fireworks when Adobe bought out Macromedia. It can save PNG8, but only with indexed-color transparency.
Anyway, full 32-bit (or even 24-bit) PNGs will be pretty large, though usually much smaller than the nearest equivalent .BMP or .TGA or uncompressed .TIFF or some such (unless you’re trying to do a photograph with it — that’s what JPEG is for!). It will usually be somewhat smaller even than .RLE (losslessly compressed .BMP) or losslessly compressed .TIF, all else being equal.
Unlike most of these other formats, PNG also supports 48-bit RGB color, with optional 16 bits of alpha transparency, for extremely high quality (much higher than most monitors can display). These are best used as an intermediate storage format, to retain information from a high bit depth scanner or camera (RAW mode) or some such. Their file sizes would be quite large, despite the lossless compression.
One thing that .PNG cannot currently do is handle non-RGB color spaces such as CMYK or L*a*b.
In short:
For photographs, use .JPG.
For line art and logos of limited color, use indexed-color .PNG (PNG8), with alpha transparency if needed.
For line art and logos of extensive color (e.g. lots of gradient fills, metallic chrome-type reflection effects, etc.), use direct-color .PNG (PNG24) with alpha if needed, if you want the best quality or need transparency (and don’t mind it not working in IE6 or use one of a variety of IE6 workarounds for transparent PNGs), and don’t mind the larger files and bandwidth usage. Otherwise, use .JPG, but be aware that the quality will be degraded. You may need to crank the JPEG quality up pretty high, especially for logos or other graphics with “text” in them, which would reduce your file size savings.
For non-Flash/Silverlight/video/HTML5 Canvas animations, .GIF if the main choice at present, but be prepared to switch to APNG (I don’t think MNG is going to beat it, despite the more official support from the JPEG developers).
JPG is a lossy compression algorithm while PNG is a lossless one.
This fact alone will (in general) make JPG images smaller than PNG ones. You can tweak the compression ratios for each format, so it could also be that you're not compressing your PNG files as much as your JPG ones.
For a photographic image saving as JPG will usually produce a smaller file than PNG as there's more noise or randomness in the image for the compression to work with. Images created by graphic art tools will tend to have more hard edges and areas of solid colour which will compress better in PNG.
If you have text in your image then PNG is going to produce a better quality image as the harder edges of the characters won't be blurred like they would be if JPG is used.
GIF is smaller because it's based on an colour palette (of 256 colours) rather than the separate RGB values for each pixel (or group of pixels) in JPG and PNG.
The PNG format can provide images of 24 bits per pixel or 8 bits per pixel. JPG is a 24 bit format, but it uses lossy compression to reduce the file size significantly. PNG and GIF both use lossless compression, but GIF only works with 8 bits so it requires your image to have 256 colors or less - this often results in a grainier picture.
Try the -colors and -dither options in ImageMagick to reduce the number of bits in your PNG output. At that point it should be comparable to the GIF file size. If you need to reduce it further, there are utilities to optimize the PNG.
The .jpeg file format is a lossy format, it throws information away. Which makes for good compression ratios. The .gif file format is not lossy but loses other information, it only supports 256 colors. The .png file format is not lossy and preserves the color range.
It depends on the kind of image. JPEG's lossy compression works very well on images with lots of color gradients (i.e. photos).
Try it on an image consisting of areas with the same color separated by sharp edges (screenshots are good, unless they show a photo desktop background, and the fancy window borders and task bar of Vista and Windows 7 also tend to mess this up). JPEG is bad at that kind of thing, and you'll probably find PNG to compress better (probably better than GIF too).
Replying to :
Does anyone know what the hack is going on? Am I doing something wrong?
yeah I study this, you aren't doing nothing wrong, you produced 8-bit/color RGB PNG
I solve it with reduce or compress png with pngnq ( http://pngnq.sourceforge.net/ ) that produce 8-bit/color colormap PNG.
pngnq seems to me the most improved project, since is a fork of others like pngquant etc, and is normally in main stream of Linux distros so I just do this:
convert photo.jpg png:- | pngnq -s 1 > photo.png
For the last upvoter (2016): pngnq as been deprecated in favor of pngquant (https://github.com/pornel/pngquant)

Resources