can the gdlibrary have different settings when imagemachine triggers a resize?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kayakbabe
    Mega Mivite




    • Jun 2008
    • 1520

    #1

    can the gdlibrary have different settings when imagemachine triggers a resize?

    We are having problems with a few images that have very hot colors like magentas and oranges in them.
    The GD Library seems to be squashing those colors and so those images look muddy.
    On our old store where we spun our own stepchild version of imagemachine but used imagemagik instead of gdlibrary
    and this problem doesn't happen.

    I saw a this gd-library color problem mentioned on stackoverflow several times. it was even posted again just a few days ago.
    One solution was to change the imagecreate() function to imagecreatetruecolor().
    I am wondering which one Miva implemented for imagemachine.
    And can it be changed?
    We have quite a few products in 'hot' colors like hot pink, bright magenta and translucent pink and orange products
    that this is happening to.

    We even testing using both 80% and also 100% uncompressed source images to upload and playing with the store compression settings changing it from our default or 85% to 90%. No combination helped.

    I'm pretty sure it's the gdlibrary underlying imagemachine that is causing this.
    Is there some way to add some flags to the resizing calls that imagemachine is making?
    Last edited by kayakbabe; 05-17-13, 01:19 PM.
  • burch
    Administrator

    • Mar 2009
    • 630

    #2
    Re: can the gdlibrary have different settings when imagemachine triggers a resize?

    Miva Merchant always creates a truecolor destination image when the source image is truecolor and the underlying gd library supports it.

    Is there any possibility that your engine configuration is referencing an old version of the gd library? gd did not support truecolor images until version 2.0 and the output images from earlier versions are absolutely awful.

    Also, if you can provide us with one of the source images and a bad resized image we can look into it further. You can email them to me directly if you prefer.

    Comment

    • kayakbabe
      Mega Mivite




      • Jun 2008
      • 1520

      #3
      Re: can the gdlibrary have different settings when imagemachine triggers a resize?

      yes i'll email them. you probably don't want them posted here since they are bright translucent pink adult novelty products.
      :-) I put them in support ticket #UEN-560-97090.

      Comment

      • burch
        Administrator

        • Mar 2009
        • 630

        #4
        Re: can the gdlibrary have different settings when imagemachine triggers a resize?

        I'll have someone look at them. I can't promise it will get done today, but we should be able to look at them early next week at the latest.

        Comment

        • Eric Foresman
          Miva Merchant Development Team



          • May 2011
          • 402

          #5
          Re: can the gdlibrary have different settings when imagemachine triggers a resize?

          HI kayakbabe

          I did some testing with the images you sent, resizing them with imagemagik vs image machine. The imagemagik version of the resized image was very slightly better then the image machine version at 100% quality.

          I recommend setting the JPEG Image Quality to 100 under the upload settings tab on domain settings, and then using image management to delete the resized images so that they will regenerate at the new quality.

          Let me know if that makes a difference for those images on your site.

          Thanks

          -Eric
          Eric Foresman
          Software Tester
          Miva Merchant
          http://www.mivamerchant.com/
          [email protected]

          Comment

          • kayakbabe
            Mega Mivite




            • Jun 2008
            • 1520

            #6
            Re: can the gdlibrary have different settings when imagemachine triggers a resize?

            Originally posted by Eric Foresman View Post
            HI kayakbabe

            I did some testing with the images you sent, resizing them with imagemagik vs image machine. The imagemagik version of the resized image was very slightly better then the image machine version at 100% quality.

            I recommend setting the JPEG Image Quality to 100 under the upload settings tab on domain settings, and then using image management to delete the resized images so that they will regenerate at the new quality.
            Eric that 100% resizing compression really isn't a viable solution. We will end up with resized images that have larger file sizes than the original. That uses up a lot of bandwidth.

            Image magick has always been better at jpegs than GD Library. Apache just decided to offer GD instead as a module first so it got much wider and earlier adoption. Probably some license issues or something back in the day. I chose imagemagick because it was better.

            After reading about this all night, I think the issue is twofold.
            1. Current incarnations of GDLibrary strip,off the ICC color profile before processing the image. GD treats the images like they are sRGB. I uploaded a cmyk and also an Adobe 1998 version of the same original image and its way worse w a cmyk image. Adobe 1988 doesn't change as much, and sRBG not quite so much ( but still more than should be expected if this were the only happening). Which leads to number 2.
            2. The default algorithm used to re sample the image when resizing, is probably optimized for speed and not quality. Bilinear vs bicubic and even other interpolation types can really affect the quality of the resized compressed jpeg. I think only the most recent releases of gd library even offer the interpolation function. I wonder if interpolation can be set up in the initialization of GD library so the interpolation can be set server wide as the default?

            This stuff probably doesn't matter for most sites though unless they have pictures like ours. Photos of scenes that are very busy without large areas of near colored pixels wouldn't be an issue. Images that are of items that are large areas of very near colors do.. For example, the hide of a palamino horse, the fur on a yellow lab puppy, a whole cloth quilt made of solid color fabric. It is very noticeable for a photograph of intensely colored object like a bright red shiny rubber ball, or a hot pink translucent textured object.

            Comment

            • burch
              Administrator

              • Mar 2009
              • 630

              #7
              Re: can the gdlibrary have different settings when imagemachine triggers a resize?

              I believe you are 100% correct about the way the GD library handles images and most people will agree that it creates lower quality images than ImageMagick.

              We would have preferred to use ImageMagick when we were implementing the image resizing functionality--in fact, we initially started building the functionality using ImageMagick instead of GD. Unfortunately we ran into issues with the architecture of the ImageMagick API that make it incompatible with our engine security model, which is why we ended up using GD.

              I took a look at the 2.1.0 alpha source code for GD and it appears they do have new interpolation methods available for scaling and rotating. They have been implemented as entirely new functions (rather than changing the behavior of the existing functions), which means using them within Miva Merchant would require deploying a custom built version of GD on your server, an engine update to make the new functions available to Miva Merchant and Miva Merchant changes to make use of the new functions.

              For a nearer term solution in your case, we might be better off looking at a technique which would allow you to use our imagemachine functionality and provide pre-sized images created to your standards with ImageMagick.
              Last edited by burch; 05-20-13, 09:20 AM.

              Comment

              • kayakbabe
                Mega Mivite




                • Jun 2008
                • 1520

                #8
                Re: can the gdlibrary have different settings when imagemachine triggers a resize?

                Too bad the GD Library developers just didn't make it more backwards compatible.
                Would be super nice if setting the interpolation method was as simple as a setting in a config file, so a reboot of the server would instantiate it. Or better yet, even have it defined on a per site basis like so many of the other server vars can be.

                That proposed custom built gd library and modified miva engine sounds complicated and might make maintaining the server a painful thing. I"ll talk it over with everyone here.

                Comment

                • burch
                  Administrator

                  • Mar 2009
                  • 630

                  #9
                  Re: can the gdlibrary have different settings when imagemachine triggers a resize?

                  Originally posted by kayakbabe View Post
                  That proposed custom built gd library and modified miva engine sounds complicated and might make maintaining the server a painful thing. I"ll talk it over with everyone here.
                  I wasn't suggesting that we would make you a custom engine--such changes would have to wait until a future software release. I've filed a ticket to support the new GD interpolation functions for the 5.20 engine, but there is no hard release date for 5.20 yet. I wouldn't expect Miva Merchant support for the new GD functions until PR9 at the earliest.

                  We did check your server and it appears to have the latest GD library available for its OS. If the image quality isn't acceptable the only short term solution would be to figure out a workflow that allows you to resize the images outside of Miva Merchant.

                  Comment

                  • kayakbabe
                    Mega Mivite




                    • Jun 2008
                    • 1520

                    #10
                    Re: can the gdlibrary have different settings when imagemachine triggers a resize?

                    We used to do that outside of Merchant. However, I really like imagemachine. It really is one of the best features of 5.5. It makes it really easy to change sizes out on the fly and since you guys maintain the code to be secure and pci-dss compliant, it's even better!

                    Thanks for putting support for gdlibrary interpolation improvements on the to-do list for PR9.
                    We will be looking out for PR9. I've heard good things about the new features and improvements coming with it. Can't wait! :-)
                    Last edited by kayakbabe; 05-22-13, 08:41 AM.

                    Comment

                    Working...
                    X