Compress images in smartest way - c#-4.0

I have many images in the source folder, which are 10 MB each. I need to two operation on that image:
To compress that image and place it on destination folder 1
To create a thumbnail and place it on destination folder 2
As there are large number of images and they all are of huge size, can you guide me the fastest way to achieve this which consume less memory.

Disclaimer: I'm the author.
The http://imageresizing.net/ library does very memory-efficient image resizing - it's designed for server-side use, so naturally it is quite fast and designed for minimal memory use.
It's also simple to use.
ImageBuilder.Current.Build(sourceFile,destFile, new ResizeSettings("format=jpg;quality=90"));
ImageBuilder.Current.Build(sourceFile,destFile, new ResizeSettings("maxwidth=100;maxheight=100;format=jpg"));
There are 50+ different options - so pretty much any kind of automatic cropping, padding, seam carving, rotation, flipping, watermarking, etc. is possible.
I'm also working on a plugin which uses WIC for simple resize operations, which might give you a 2x speed boost. Let me know if you're interested in beta-testing it.

Related

How can I compress an object in Unity?

I am an Android programmer, and I need to compress object's size like how WinRAR works for decreasing the size of folders and many file formats.
Please suggest software for decreasing the size of objects by compressing or decreasing polygons without changing quality.
Theres a few ways to do this. Assuming your objects are in .FBX format or .3DS or similar, Blender is a handy tool for any form of object changes, including reducing polygon count. Check out the tutorial below on how to do so via blender:
http://www.blender.org/manual/modifiers/generate/decimate.html
Once reduced, save and reimport/replace existing object back into the game. You can see the reduction in real time so you can find that sweet spot for when you feel the object is reduced too much.
If you want something within Unity, cruncher or simplygon are available in the asset store which is targetted to reduce polygon counts.
Simplygon
https://www.assetstore.unity3d.com/en/#!/content/10144
Cruncher
https://www.assetstore.unity3d.com/en/#!/content/4294
Hope this helps.

Image size optimisation in Linux

There is a Yahoo "Smush.it" service that allow to optimise image size.
I am looking for alternative way to reach the same goal using Linux application.
A lot of images need to processed and uploading them manually one by one seems not a good idea.
How such can be done in Linux ?
For jpegs I use JPEGmini and from what I tested it's the one with the best results keeping the same visible image quality while reducing a lot of the size, they have a server version for Linux which is not cheap and I never used.
There's also Mozilla's mozjpeg which you can use directly from the terminal, but it also reduces image quality.
In some tests I did, mozjpeg gives smaller files (not much) than JPEGmini's, but with lower image quality.
If you need to reduce pngs, you could try Trimage or some of the alternatives listed on the same link.
Smush.it's FAQ lists all the tools they are using in their service.

what format of pic can generate mimap in opengl-es

as the title, I used to use .dds, it did work,now I use type of .png, can it generate mipmap? Here functions what I am using: glTexImage2D(…).Or maybe gluBuild2DMipmaps(…) a better choice?
DDS are an image format that contains precalculated mipmaps. As far as quality goes, precalculated mipmaps offer the best quality, since they can be downsampled offline with advanced filter kernels like Lancozs, without having to care about runtime efficiency.
PNG does not contain additional mipmap levels so you have to compute the mipmaps at runtime. You should however not use gluBuild2DMipmaps for this. For one this function is known to exhibit buggy behavior in certain conditions and furthermore it will unconditionally resample all images to power-of-2 dimensions, although since OpenGL-2 non power-of-2 dimensions are perfectly fine for texture images.
Instead you should load the base level image with glTexImage2D(…) and use glGenerateMipmap(…) (available since OpenGL-3) to build the mipmap image pyramid from there. If you don't use OpenGL-3, you can use the SGIS_generate_mipmap extension, if available.
However be advised that online mipmap generation may yield not as good results as offline generation.
Another possible approach would be the use of JPEG2000 images; the nature of JPEG2000 image encoding results in an image pyramid being readily available. OTOH JPEG2000 is very costly to encode and decode.

android:pitfalls of deleting ldpi/mdpi folders

I was wondering what are the pitfalls of deleting the ldpi/mdpi/hdpi folders on my android project? Can i just copy all the images in the drawable folder instead?
I did see the following links about UI development for android
http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
http://developer.android.com/guide/practices/screens_support.html
thanks
PS: I 'm referring to all the images that are being used, background,icons,menus etc...
If you want to, go for it. Although not the best practice, if your application is quite conservative in terms of graphics then this may be a reasonable approach.
PROS:
Smaller .apk size
Easier to manage images (add/edit/remove)
CONS:
Images may be too high res or too low res for different screen resolutions.
If too high, images are scaled down on the fly which eats up processing power (+ unnecessary memory consumption).
If too low, images will lack detail and may look bad.
Lower-end devices have a lower memory cap (lowest being 16MB I think) - what may seem to work on your test device may not work on another (OutOfMemoryError!).
Update
If you want a quick way to make icons for all resolutions check out: Android Asset Studio

How to put textures in one file (power of 2)

I want to create big texture which is power of 2 and put in this file a lot of smaller textures.
You know, I have several textures which are not power of 2 so I cant load them to my program. I have to put them in one file (512x512 for example).
Do you know any program which can do it for me automaticly?
Is there any limit of size of texture? Can I use for example 8192x8192 file? Or I have to use few smaller.
The keyword you're looking for is texture atlas.
The maximum texture size is GPU-dependent, 8k is fine on newer cards. Such a texture consumes, however, a vast amount of VRAM (and it gets worse if you count in MIPs). So it might be better to use several smaller textures and have only those in (hot) VRAM which you really need.
There are several applications that can help you pack images into a texture atlas. Zwoptex has both a free Flash version and a commercial Mac app. TexturePacker has a Mac and Windows app, and a command line version, some features are free and some require a paid license. These output the packed images into a single image and an associated data file with coordinates on the location of the packed images. They also can trim the transparent regions from around any given image, if any, saving even more space.
There are some more tools, some open source, listed in answers to this question.
The advantages of packing into one texture are potential space saving, but also fewer OpenGL state changes when drawing several images from the texture, for better performance.

Resources