Giter VIP home page Giter VIP logo

Comments (8)

sorl avatar sorl commented on June 10, 2024

Interesting, do you have some files I can test?

from sorl-thumbnail.

mattaustin avatar mattaustin commented on June 10, 2024

I think I might be experiencing the same issue here.

Original image:
http://cdn.perth2011.thecut.net.au/uploads/media/images/2011/12/07/PAULPRK25315.jpg

Sorl thumbnail output:
http://cdn.perth2011.thecut.net.au/cache/cd/ac/cdacf46b8c7133f854c0281352fa7290.jpg

from sorl-thumbnail.

hhatto avatar hhatto commented on June 10, 2024

Hi.

I think that the problem has occurred since Image.type() and Image.quantize() are used simultaneously.
But, I don't prove it. Could you check once?

now:

    def _colorspace(self, image, colorspace):
        if colorspace == 'RGB':
            image.type(ImageType.TrueColorMatteType)
            image.quantizeColorSpace(ColorspaceType.RGBColorspace)
        elif colorspace == 'GRAY':
            image.type(ImageType.GrayscaleMatteType)
            image.quantizeColorSpace(ColorspaceType.GRAYColorspace)
        else:
            return image
        image.quantize()
        return image

fix:

    def _colorspace(self, image, colorspace):
        if colorspace == 'RGB':
            image.type(ImageType.TrueColorMatteType)
        elif colorspace == 'GRAY':
            image.type(ImageType.GrayscaleMatteType)
        else:
            return image
        return image

reference: http://www.graphicsmagick.org/Magick++/Image.html

  image.quantizeColorSpace( GRAYColorspace );
  image.quantizeColors( 256 );
  image.quantize( );
  
  or, more simply:
  
  image.type( GrayscaleType );

Thanks.

from sorl-thumbnail.

mattaustin avatar mattaustin commented on June 10, 2024

Thanks hhatto, that did the trick!

from sorl-thumbnail.

sorl avatar sorl commented on June 10, 2024

Nice! Please make patch or pull req. if possible at all try to make a test too :)

from sorl-thumbnail.

sorl avatar sorl commented on June 10, 2024

Can you please just try it so that it does infact make a grayscale image from a color one?

from sorl-thumbnail.

mattaustin avatar mattaustin commented on June 10, 2024

Confirming that specifying colorspace="GRAY" still greyscales a color image.

from sorl-thumbnail.

sorl avatar sorl commented on June 10, 2024

Thanks! & thanks hhatto for pgmagick!

from sorl-thumbnail.

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.