When I save a image from a picturebox using Picturebox1.Image.Save, the saved image size is much larger than the original image size (for example, from 1.5 MB to 15 MB). What can I do for the image will be saved in the same size of the original image?
Thank you in advance.
You probably load a JPEG or PNG image into the Picturebox, which are compressed file formats. However Picturebox1.Image.Save saves it as a bitmap, if you do not specify the type. Bitmaps are uncompressed and therefore quite large. You can change this by using
Picturebox1.Image.Save(Outputfilename, Drawing.Imaging.Imageformats.Png)
This saves the image in the PNG-Format, which is much smaller.
Related
Is it possible to increase the 40KB jpeg to 40 MB?
If have tried by adding multiple images to paint
It was not working
Please help me to resolve
Then I want to create a pdf which should have more than 25MB
I have scanned my copybook and want to crop out extra white regions with Inkscape.
To achieve this, I import initial image (PDF) to Inkscape, draw appropriate rectangle, and use Object->Clip->Set to cut out needed region. Then I resize page to drawing and save obtained page as new PDF file through File->Save a Copy.
I expected that the size of the new PDF file (with cropped image) will be less than the size of the initial PDF (with image without crop), but they are the same.
What is the reason of this and may it be worked around?
I use Inkscape 0.91 at Linux Mint 18.2.
Thank you in advance.
Because the original image is still there, fully intact and with all its contents. The cropping rectangle are just instructions to the PDF viewer to crop out those regions when rendering the image.
However in Inkscape you can bake the crop rectangles and when exporting to PDF "apply raster effects" which should actually alter the contained image(s).
I have a search icon at 2kb. I open in Photoshop, reduce it's dimensions to half, and the size comes out as 4kb.
Any idea what I can do to reduce the size when saving and reducing the dimensions? Not sure what's causing this.
Thank you!
When object is a vector it cost low space in the photoshopfile.
you can use png8 instead of png24 to save a lot of bytes
I have tried the following methods,
normal image upload.
encoding and decoding.
these two methods are taking long time to upload the image.
Any suggestion?
There are some simple ways:
Reduce the size of the image. From 1000x1000 to 500x500
Reduce the bpp of the image. For example instead of RGBA representation (32 bits per pixel) use RGB_565 (16bits per pixel) or even gray level image (8bits)
Reduce the quality of the image. Save it as .jpg. This will make the image much smaller. You can play with the quality parameter of jpeg. 100% means very high quality and large files, 1% means extremely tiny images (~40 times smaller) but all the details will be lost.
Save the image in Jpeg200 format. It reduces the size even further. Not every browser supports this format, so you might need to convert it to regular jpeg.
Use pyramids of images. For example. You have 1000x1000 image. Reduce its size by 2 to get 500x500, reduce again and again. Now you got 4 images 1000x1000, 500x500, 250x250, 125x125. You upload the 4 of them. Starting from the smallest to the largest. The smallest image will be uploaded very quick and you will be able to display it (though it is in lower resolution). Next when a better image arrives you update the display and resolution enhances. The effect would be that the basic image is loaded extremely fast and over time the resolution is enhanced. The transfer time of the 4 images will take only 30% more time than the original but the first one will arrive 64 times faster than the original
These are the basic solutions. If they are not what you needed please refine the question
I have a background file that I wish to use in an iphone game which is currently 40mb. It is a .png file and I would like to compress it to the smallest size possible without losing much quality AND without losing the alpha channel. I have successfully changed the file size of a similarly large file simply by changing its file type to a .jpg file. However, this image didn't have any transparency, and as far as I know you cannot change a .png to a .jpg without losing transparency. Perhaps I am wrong however(and please correct me if I am.) If there is a way to compress this .png file please explain to me how it is done. Also, please be aware that it is quite a large file and it would be preferable that it compressed within a time range of 5 hours or below if possible. Thanks!
How are you building the game? If you're using OpenGL directly, and if you're happy with the compression it offers, PVR is an awesome format for far smaller and really quick images.
PVRTC on Wikipedia
As keegan3d said, Xcode recompresses PNG images, using PNGCrush. It changes the byte order and premultiples the alpha. This article explains what happens: iPhone "Optimized" PNGs
If you leave Xcode's PNG compression enabled, then you won't see any benefits from using PNG compression tools: PNG compression and iOS apps
If you'd like to disable Xcode's compression for one image only (so you can use an alternate compression tool), I believe you can change the file type from image.png to file, as explained here: How can I skip compressing one PNG?
And... be a little careful with RAM usage. A JPEG and PNG will both decompress to the same size (assuming they have no alpha). 40MB is quite big. Do you have other ways of drawing the background? I've worked on a game with a bitmap 2048 x 2048 play area that was bitmap based. We use PVR and tiles. PVR images use less RAM than PNG, and are quicker.
Xcode compresses pngs, you should look at how large the image actually is inside the built app. It is possible to compress images more than Xcode does with ImageOptim but they are slightly slower to display on screen, this probably wouldn't be an issue for your background image.
In my benchmark smallest size and fastest loading PNG images were PNG8+alpha created with ImageAlpha/pngquant.
If your background is mostly flat or monochromatic (not too much blur/gradients), then it will look fine as PNG8+alpha.
You can improve compressibility of PNG24+alpha images by posterizing them in a smart way.
However, a 40MB PNG image is still huge. I wouldn't be surprised if it was causing you memory issues. Consider splitting it into smaller tiles.