What's the size of the newest AppIcon for Xcode 8 and how to get them in an easier way? - ios10

I just updated my Xcode to Version 8, the AppIcon I built before (for Xcode 7) are not useful anymore. And I have tried many online AppIcon generators but no one can create a full set of the AppIcon. The new version of AppIcon set is as below:
Besides, I have searched the official doc of AppIcon, the explanation and descriptions are all about the previous version. There is even no doc describing the icon size of iPhone 7. Below is a table in the Apple doc:
Anyone know the size of the whole set of AppIcon? Anyway to generate them expediently?

When you see 20pt 2x it should be 40x40, 60pt 2x 120, and 60 pt 3x 180, you just need to multiply the pt value by the x value.
To generate all the sizes I recommend using Inkscape which is excellent at resizing images.

Create your 1024x1024 icon, install imagemagick on your mac and run this script
#!/bin/bash
convert icon1024.png -resize 40x40 icon20ptx2.png
convert icon1024.png -resize 60x60 icon20ptx3.png
convert icon1024.png -resize 58x58 icon29ptx2.png
convert icon1024.png -resize 87x87 icon29ptx3.png
convert icon1024.png -resize 80x80 icon40ptx2.png
convert icon1024.png -resize 120x120 icon40ptx3.png
convert icon1024.png -resize 120x120 icon60ptx2.png
convert icon1024.png -resize 180x180 icon60ptx3.png

Related

Lossless compression of a sequence of similar grayscale images

I would like to have the best compression ratio of a sequence of similar grayscale images. I note that I need an absolute lossless solution (meaning I should be able to check it with an hash algorithm).
What I tried
I had the idea to convert my images into a video because there is a chronology between images. The encoding algorithm would compress using the fact that not all the scene change between 2 pictures. So I tried using ffmpeg but I had several problems due to sRGB -> YUV colorspace compression. I didn't understand all the thing but it's seems like a nightmare.
Example of code used :
ffmpeg -i %04d.png -c:v libx265 -crf 0 video.mp4 #To convert into video
ffmpeg -i video.mp4 %04d.png #To recover images
My second idea was to do it by hand with imagemagik. So I took the first image as reference and create a new image that is the difference between image1 and image2. Then I tried to add the difference image with the image 1 (trying to recover image 2) but it didn't work. Noticing the size of the recreated picture, it's clear that the image is not the same. I think there was an unwanted compression during the process.
Example of code used :
composite -compose difference 0001.png 0002.png diff.png #To create the diff image
composite -compose difference 0001.png diff.png recover.png #To recover image 2
Do you have any idea about my problem ?
And why I don't manage to do the perfect recover with iamgemagik ?
Thanks ;)
Here are 20 samples images : https://cloud.damien.gdn/d/f1a7954a557441989432/
I tried a few ideas with your dataset and summarise what I found below. My calculations and percentages assume that 578kB is a representative image size.
Method 1 - crush - 69%
I just ran pngcrush on one of your images like this:
pngcrush -bruteforce input.png crushed.png
The output size was 400kB, so your image is now only taking 69% of the original space on disk.
Method 2 - rotate and crush - 34%
I rotated your images through 90 degrees and crushed the result:
magick input.png -rotate 90 result.png
pngcrush -bruteforce result.png crushed.png
The rotated crushed image takes 34% of the original space on disk.
Method 3 - rotate and difference - 24%
I rotated your images with ImageMagick, then differenced two adjacent images in the series and saved the result. I then "pngcrushed" that which resulted in 142kB, or 24% of the original space.
Method 4 - combined to RGB - 28%
I combined three of your single channel images into a 3-channel RGB image and pngcrushed the result:
magick 000[123].png -combine result.png
pngcrush -bruteforce result.png crushed.png
That resulted in a 490kB file containing 3 images, i.e. 163kB per image or 28% of the original size.
I suspect video with "motion" estimation/detection would yield the best results if you are able to do it losslessly.
You might get some gain out of MNG, which is intended for lossless animation compression. You can use libmng to try it out.

Imagemagick create thumbnail

I have an image that is 200x200 I want to trim the white space, and make it into an icon that is 32x32.
convert img.png -trim -resize 32x32 imgi.png
This line of code does not work, it will not make the canvas a uniform 32x32. I have tried taking it and adding -canvas 32x32 or -extend 32x32 but then the script does not work at all.
I am doing this from PHP with exec so I do not get an error back.
You can pad to tweak dimensions of the image after cropping. As of ImageMagick version 6.3.2 you can use -extent option to modify end result.
convert img.png -trim -resize 32x32 -gravity center -extent 32x32 imgi.png
For earlier versions it is necessary to play with -border, -crop and +repage.
convert img.png -trim -resize 32x32 -bordercolor white -border 16 -gravity center -crop 32x32+0+0 +repage img.png;

Tesseract and tiff format - spp not in set {1,3}

While trying to run this command:
tesseract bond111.tif bond111 batch.nochop makebox
I get the next error
Error in pixReadFromTiffStream: spp not in set {1,3}
Error in pixReadStreamTiff: pix not read
Error in pixReadTiff: pix not read
Assuming that spp not in set is the main error here, what does it mean?
At first it had trouble because the bpp was higher than 24 so I reduced it using Gimp but that did not resolve the issue.
It probably means your TIFF image has an alpha channel and therefore the underlying Leptonica library used by Tesseract doesn't support it. If you're using Imagemagick then be aware that operations such as -draw can cause alpha channels to be added. If you're using convert in your workflow and want to remove the channel again immediately, flatten the image before writing by adding -background white -flatten +matte before the output filename, e.g.:
convert input.tiff -fill white -draw 'rectangle 10,10 20,20' -background white -flatten +matte output.tiff
Tesseract (well, Leptonica) accepts PNGs these days and is less picky about them, so it might be easier to migrate your workflow to PNG anyway.
Sources: magick-users mailing list posting; tesseract-ocr mailing list posting
Thanks for your post ZakW, you pointed me to the right direction.
Anyhow i also needed to set '-depth 8'. Quality was not good enough for OCR, whatever I tried.
What worked for me is this solution:
ghostscript -o document.tiff -sDEVICE=tiffgray -r720x720 -g6120x7920 -sCompression=lzw document.pdf
tesseract document.tiff document -l deu
vim document.txt
This way I got perfect text with Umlauts in german.
Adjusting the conversion to the following line did help me.
convert -density 300 input.pdf -depth 8 -background white -alpha Off output.tiff
Note that the other answers did not work for me since they use the deprecated +matte flag instead of -alpha Off.
You can try using the command 'tiffinfo' provided by libtiff_tools to verify the TIFF format of your src image. A number of TIFF formats exist, with different values for Bits-per-pixel (bpp) and Samples-per-pixel (spp).
Error in pixReadFromTiffStream: spp not in set {1,3,4}
An 'spp' value of 2 is invalid for TIFF.
I solved the problem by saving directly to TIFF format from Gimp, instead of converting from .png to .tif using ImageMagick's 'convert'.
See also: TIFF format

Graphicsmagick how to forcely covert 32bit image to 24bit bitmap

I would like to force all the input image to be converted into 24bit bmp format. what parameters in gm command line I should add?
gm convert input.png -resize 1920x1080 out.bmp
I think i figured out, just let you guys know
gm convert input.png -resize 1920x1080 +matte out.bmp

better params for a conversion to png with imagemagick

i have to convert 60px X 60px images to png for my web site with imagemagick.
convert image.jpg image.png
But it's return an image with 4kbyte size.
I want get a size around 1kbyte.
How can i do?
thanks
Compression level is controlled by the -quality parameter, look here for more information. If you are only having images with less than 256 colors, use -format PNG8 to save some bytes. And try to add -type optimize.