I am using Generic Handler to Load Images. I am converting TIFF images to PNG Format. Now i need to compress the size of the PNG Image not the quality. Please suggest me the best free Image Compressor SDK.
How can i compress image using 7z. I think you not getting my question. When i am loading image from network i am getting TIFF image now i am converting TIFF to PNG and it takes 3.52 Sec to load image. I need to decrease that loading amount. I need to compress
the image size not the quality....
just came across this: One good strategy "to compress PNG" files is converting them into jpg since PNG compression is very limited in most cases and based on removing obsolete header information etc. With JPG you can reach a very high comrpession level which
is what you want to have fast websites. A good service to convert png to jpg is the following one: It also allows multiple files
www.png-to-jpg.com
There are a number of utilities out there to optimize PNG images like PNGOUT and OptiPng that are command line utilities. You can shell out from your ASP.NET app and call these to compress your images in place. Note though these tend to be pretty slow -
it can take a while to optimize large images.
However - TIFF images tend to be photos or photo-quality art, so generally PNG is not a good format for that. The problem is that PNG is lossless and it's not very good at very high res detailed content. You can *optimize* PNG by removing colors and transparency,
but there's no way to 'compress' PNG.
For photo-quality images if you want decent compression use JPEG or JPEG2000 (although that's not supported widely). Then play around with different image compression ratios. You can do JPeg compression with GDI+ if necessary or there are also command line
utilities to do it for you.
The way I've done this is by shelling out to a tool like PngOut.exe to let it do the compression. Here's what I do on my blog with post images uploaded as part of my MetaWebLog API media uploads:
// png gets written here
bitmap.Save(ImagePhysicalPath);
if (Path.GetExtension(ImagePhysicalPath).ToLower() == ".png")
{
var pngOutPath = HttpContext.Current.Server.MapPath("~/") + "tools\\pngout.exe";
var p = Process.Start(pngOutPath, "\"" + ImagePhysicalPath + "\"");
p.ErrorDataReceived += (sender, e) =>
{
LogManager.Current.LogError("pngOut failed", e.Data);
};
}
It works great, but it's pretty slow - all the compression tools I've seen and used are this slow so this inherent to the process of optimizing PNG in a lossless manner.
Member
46 Points
119 Posts
Compress PNG Image ?
Jun 21, 2012 12:08 AM|ravi010mittal|LINK
Hello World
I am using Generic Handler to Load Images. I am converting TIFF images to PNG Format. Now i need to compress the size of the PNG Image not the quality. Please suggest me the best free Image Compressor SDK.
Please let me know asap
Ravi Mittal
Code Help Code
Participant
1340 Points
476 Posts
Re: Compress PNG Image ?
Jun 21, 2012 12:14 AM|sunilgurjar|LINK
try this
http://www.dotnetspider.com/forum/303988-Simple-Image-Compression-Technique-.net.aspx
read my blog
http://sunilgurjar.blogspot.com/
Member
46 Points
119 Posts
Re: Compress PNG Image ?
Jun 22, 2012 12:15 AM|ravi010mittal|LINK
Thanks for Reply...I do not want to specify any new size of image. Can we compress the original image with Original Size ?
Ravi Mittal
Code Help Code
Member
46 Points
119 Posts
Re: Compress PNG Image ?
Jul 03, 2012 03:31 AM|ravi010mittal|LINK
Please let me know if there is any lossless image Compression algorithem in Asp.NET
Ravi Mittal
Code Help Code
Contributor
2842 Points
767 Posts
Re: Compress PNG Image ?
Jul 03, 2012 03:43 AM|mshoaiblibra|LINK
you should use 7z sdk to compress and decompress a file:
http://stackoverflow.com/questions/7646328/how-to-use-the-7z-sdk-to-compress-and-decompress-a-file
More help full metrial:
http://stackoverflow.com/questions/8340636/using-7zip-sdk-to-compress-a-file-but-the-archive-file-is-not-as-original-and-c
http://geekswithblogs.net/bullpit/archive/2009/04/29/compress-image-files-using-c.aspx
M Shoaib Waheed
MCSD & MCPD [Web Development 4.0]
http://shoaib.pk
Member
46 Points
119 Posts
Re: Compress PNG Image ?
Jul 04, 2012 12:55 AM|ravi010mittal|LINK
How can i compress image using 7z. I think you not getting my question. When i am loading image from network i am getting TIFF image now i am converting TIFF to PNG and it takes 3.52 Sec to load image. I need to decrease that loading amount. I need to compress the image size not the quality....
Ravi Mittal
Code Help Code
None
0 Points
1 Post
Re: Compress PNG Image ?
Feb 04, 2015 04:47 PM|marc_aurel|LINK
Hey,
just came across this: One good strategy "to compress PNG" files is converting them into jpg since PNG compression is very limited in most cases and based on removing obsolete header information etc. With JPG you can reach a very high comrpession level which is what you want to have fast websites. A good service to convert png to jpg is the following one: It also allows multiple files www.png-to-jpg.com
I use it for all my projects.
Cheers!
Participant
1471 Points
442 Posts
ASPInsiders
MVP
Re: Compress PNG Image ?
Apr 17, 2015 05:08 AM|rstrahl|LINK
There are a number of utilities out there to optimize PNG images like PNGOUT and OptiPng that are command line utilities. You can shell out from your ASP.NET app and call these to compress your images in place. Note though these tend to be pretty slow - it can take a while to optimize large images.
However - TIFF images tend to be photos or photo-quality art, so generally PNG is not a good format for that. The problem is that PNG is lossless and it's not very good at very high res detailed content. You can *optimize* PNG by removing colors and transparency, but there's no way to 'compress' PNG.
For photo-quality images if you want decent compression use JPEG or JPEG2000 (although that's not supported widely). Then play around with different image compression ratios. You can do JPeg compression with GDI+ if necessary or there are also command line utilities to do it for you.
This StackOverFlow question lists a bunch of tools you can try:
http://stackoverflow.com/questions/19153122/image-compression-tools-via-command-line
+++ Rick ---
West Wind Technologies
Making waves on the Web
weblog.west-wind.com
Check out: Markdown Monster
Participant
1471 Points
442 Posts
ASPInsiders
MVP
Re: Compress PNG Image ?
Jun 29, 2015 03:08 PM|rstrahl|LINK
Not a simple thing to do and it's very slow.
The way I've done this is by shelling out to a tool like PngOut.exe to let it do the compression. Here's what I do on my blog with post images uploaded as part of my MetaWebLog API media uploads:
It works great, but it's pretty slow - all the compression tools I've seen and used are this slow so this inherent to the process of optimizing PNG in a lossless manner.
Hope this helps,
+++ Rick ---
West Wind Technologies
Making waves on the Web
weblog.west-wind.com
Check out: Markdown Monster