Giter VIP home page Giter VIP logo

Comments (3)

kornelski avatar kornelski commented on May 18, 2024

Can you upload an image that would benefit from this?

To some extent pngquant already does this, as it applies different weight to edges and noisy areas of the image. I could add option to take arbitrary image mask that marks which areas of the image are most important. Would you use such feature?

from pngquant.

ttback avatar ttback commented on May 18, 2024

I would need to know more about how to embed" image mask" into the image. What would I need to do to have images work with this feature? Currently I am thinking more in terms of giving coordinate of bounding boxes as input to pngquant, but you have some better ideas, I am open to explore the options. My toolset is imagemagick and python's Pillow library. Obviously I'm not an expert, so you may have to elaborate a bit on how to take advantage of the feature.

As for benefits of having this feature, an easy example that would benefit from this are any publication-related scans, mockups that are found most in traditional media. I am working with some really old archives of scans and
I currently do not have the domain knowledge to make any available compression tool (imagemagick, pil or pngquant) to distinguish text from photos in a picture.

Currently if I run pngquant with quality 110, I can get readable text with a compression ratio of 3. (uncompressed/compressed) But the photos will look very zombie-like. I could only get out of the lossy zombie effect with quality above 60, about 6080 bound. That pushes the compression ratio down to only 1.4. Given the fact that the majority of scans are text, I am thinking that I could have the best of both worlds to keep the compression ratio at around 2.5 without losing much photo quality. I think that would be a win-win situation and makes sense for png compression strategy since text should take less color index than photos, line arts, and drawings.

A news article today just covered on museum of comic scans: http://news.yahoo.com/comics-lovers-drawn-ohio-museum-153218717.html
I am sure comic scans can benefit from this as well.

Here are some results from google search:

http://images4.wikia.nocookie.net/__cb20121008080532/assassinscreed/images/thumb/5/5a/ACi_newspaper.png/800px-ACi_newspaper.png

http://www.google.com/imgres?start=68&sa=X&biw=1920&bih=919&tbm=isch&tbnid=hU3mD1XPEMYnSM:&imgrefurl=http://en.wikipedia.org/wiki/File:BISU_Newspaper_15_March_2012_Issue_257.png&docid=BXtqR-MVuuc3zM&imgurl=http://upload.wikimedia.org/wikipedia/en/7/74/BISU_Newspaper_15_March_2012_Issue_257.png&w=1269&h=2000&ei=5ymBUoP3CrTIsASt54CIBA&zoom=1&ved=1t:3588,r:2,s:100,i:10&iact=rc&page=3&tbnh=187&tbnw=114&ndsp=45&tx=61&ty=71

http://www.google.com/imgres?sa=X&biw=1920&bih=919&tbm=isch&tbnid=AzQ60k7Za4YduM:&imgrefurl=http://rollbacktolls.com/community-newspaper-article-on-mdx-public-meeting-in-kendall/&docid=Sp5DaOLfbcmH4M&imgurl=http://www.rollbacktolls.com/wp-content/uploads/2012/06/Community-Newspaper-PNG-sheet-on-MDX-8000-palms-791x1024.png&w=791&h=1024&ei=lSmBUtbsIqbJsASV8IDgDA&zoom=1&ved=1t:3588,r:91,s:0,i:371&iact=rc&page=3&tbnh=170&tbnw=125&start=68&ndsp=45&tx=90&ty=88

http://media.smashingmagazine.com/wp-content/uploads/2011/09/newspaper-website.png

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

I see. In that case pngquant is pretty smart already and will avoid putting too much weight on anti-aliasing of text β€” specifying of areas of interest won't help much.

I think compression could be improved a bit if pngquant was lossy beyond limiting number of colors in the palette, but this could be done mostly automatically (but it's much more complicated, maybe I'll implement it… someday).

If you know coordinates of photos in the picture you may get best results if you cut photos out and store them as JPEG, and the rest as PNG (with photos blacked out).

If you can use any format, then check out DjVu format which already does this kind of text-vs-photo separation automatically.

from pngquant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.