Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matias 27 posts 68 karma points
    Apr 15, 2013 @ 13:17
    Matias
    0

    Imagegen

    Hallo everyone,

    Not sure if this is the right place to ask, please advice me if I am wrong.

    Back to my problem, which is I am not sure how imagegen resizing work. All of my pictures is not good, they are all blurred. I am using imagegen this way:

    /ImageGen.ashx?image=<xsl:value-of select="x" />&amp;width=170&amp;height=170

    Am i doing something wrong? It looks like it takes the picture from 1 side og just make is smaller until it reach the korrect size which, of course, is not good.

    Thanks in advance.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 15, 2013 @ 14:38
    Dennis Aaen
    0

    Hi Mathias,

    I have used the ImageGen packages on one of my projects, and my pictures are not blurred. I am using imagegen this way:

    <img>
        <xsl:attribute name="src">
            <xsl:text>/ImageGen.ashx?image=</xsl:text>
                <xsl:value-of select="$picFile"/>
                <xsl:text>&amp;width=146&amp;height=98%&amp;constrain=true</xsl:text>
             </xsl:attribute>
     </img>

    If this not will work for you, I think you should try ask you question in here. http://our.umbraco.org/projects/website-utilities/imagegen/imagegen-how-to

    Then I am sure that Douglas Robar can guide you in the direction.

    /Dennis

  • Claushingebjerg 939 posts 2574 karma points
    Apr 15, 2013 @ 14:50
    Claushingebjerg
    0

    Imagegen in its basic form works like this:

    <img src="ImageGen.ashx?image=beautiful.jpg&width=320" />

     

    Using umbraco library's getmedia you'll do something like:

    <img src="/imageGen.ashx?image={umbraco.library:GetMedia($currentPage/imageID,'false')/umbracoFile}&amp;width=170&amp;constrain=true" />

     

    If you scale the image above the size you set in imagegen it will get blurry. Example:

    <img src="/imageGen.ashx?image={umbraco.library:GetMedia($currentPage/imageID,'false')/umbracoFile}&amp;width=170&amp;constrain=true" width="700"/>
  • Claushingebjerg 939 posts 2574 karma points
    Apr 15, 2013 @ 14:51
    Claushingebjerg
    0

    Re-reading your question, i think youre missing the 

    constrain=true

    parameter

  • Matias 27 posts 68 karma points
    Apr 15, 2013 @ 15:15
    Matias
    0

    Thanks to both of you, It is working somehow now. Although the pictures is not being the size I am trying to make them, but that is because they can't scale right or?

  • Claushingebjerg 939 posts 2574 karma points
    Apr 15, 2013 @ 16:19
    Claushingebjerg
    0

    There is no scale limit on the free version, so that shouldn't be the problem.
    The paid version can be set up to disallow upscaling, as far as i remember

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Apr 15, 2013 @ 17:34
    Douglas Robar
    1

    Quite right, Claus, the Pro version let's you enforce a 'no upscaling' policy if you want that.

    The other reason images might be fuzzy is if you are using jpgs and set the &compression= parameter very very low, which makes very small files at the expense of image quality. The default setting tries to strike a balance between image quality and filesize.

    cheers,
    doug. 

  • Matias 27 posts 68 karma points
    Apr 17, 2013 @ 10:55
    Matias
    0

    I am not sure I understand all of this. Look at this image, these images are all ending up in a different size. Why is that?

    This is what I do:

    /ImageGen.ashx?image=<xsl:value-of select="x" />&amp;width=220&amp;height=330&amp;constrain=true

     

     

     

     

     

     

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Apr 17, 2013 @ 11:03
    Douglas Robar
    0

    It's hard to see details in the image you posted.

    Can you let us know the original dimensions of the source image(s) and also the final size that ImageGen renders the image(s)?

    I think you'll find that one of the dimensions is always 220 wide or 330 high. Because you have constrain=true the resulting image is unlikely to be exactly 220x330 unless those are also the proportions of the original image.

    If you want to place the resized image in an area padded with extra space to create an image exactly 220x330 you'll want to use the pad= parameter as well.

    cheers,
    doug. 

  • Matias 27 posts 68 karma points
    Apr 17, 2013 @ 11:27
    Matias
    0

    Though it was going to be bigger the picture, sorry about that. 

     

     

    I downloaded the pictures and look at the size they had at that moment, hope this is what you are looking for?

    Picture1After: 220x108

    Picture1Before: 596x292

    Picture2After: 220x246

    Picture2Before: 643x720

    Picture3After: 220X165

    Picture3Before: 480x360

    Picture4After: 220x202

    Picture4Before: 480x440

    Is their a different between PNG and JPEG?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Apr 17, 2013 @ 11:31
    Douglas Robar
    0

    Thanks, that's perfect.

    ImageGen is doing just what it's meant to do... create an area that is 220x330, resize the original image (constrained to its original proportions) to the largest size that will fit within that area, trim off any un-used space not needed after the resizing, and finally display the resulting image.

    It doesn't matter what the format of the original image is.

    What were you hoping would be the result of each resizing? 

    cheers,
    doug. 

  • Claushingebjerg 939 posts 2574 karma points
    Apr 17, 2013 @ 11:32
    Claushingebjerg
    0

    Its doing exactly what you're telling it to :)

    You're telling the image to retain its aspect ratio and make it no bigger than 220 pixels wide and 330 pixels high.

    If you look at your after images, they are all 220 pixels wide. And none of them are more than 330 high.

    If you want all images the same size, you need to implement some cropping.

  • Matias 27 posts 68 karma points
    Apr 17, 2013 @ 11:48
    Matias
    0

    I want the image to not be blurred and be of the same size. That is the goal of it, so they have a straight line where the picture end the same place and the tekst start at the same place.

    So you say I need cropping, how does that work in imagegen? Og why is that needed?

  • Claushingebjerg 939 posts 2574 karma points
    Apr 17, 2013 @ 11:52
    Claushingebjerg
    0

    Well, if you want them all to be the same height, just leave out the width parameter, but then the images will have different widths.

    If you want all images to be 220pixels x 220pixels for example, you can use the image cropper datatype http://our.umbraco.org/wiki/reference/default-datatypes/image-cropper

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Apr 17, 2013 @ 11:58
    Douglas Robar
    0

    With regard to being 'blurry'... I can't see the original so I can't compare. It may be that you want to use a different compression= setting than the default when you're using jpgs. It's a balance between quality and file size with jpg compression. With compression=100 you'll have maximum quality but also largest files. A value of 90 is very high quality and a noticable size savings. 80 is often a good value but quality will suffer somewhat. 

    Another option is to force ImageGen to output the format at png, which will always have maximum quality (though also have maximum file size). You can force the output format with the format= parameter.

    To get images with the exact same size you have three options:

    • constrain=false (though that will distort the image and is rarely desired)
        
    • pad=true (the perfectly resized image is centered within the requested dimensions and any unused space is filled/padded with the bgcolor)
        
    • crop=resize (the image is resized to the largest size within the requested dimensions and any extra that falls outside the requested dimensions is cropped off after resizing; this is a Professional feature but you can test it on localhost or any *.local domain)

    cheers,
    doug. 

Please Sign in or register to post replies

Write your reply to:

Draft