Announcement

Collapse
No announcement yet.

v4.23: Custom selection - Crop = incorrect size

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fixed v4.23: Custom selection - Crop = incorrect size

    Hi.

    I have an large bmp-file that I want to crop to a given size. But it's not possible to achieve the right dimension, because the cropped result almost always counts or discounts some pixels.

    For example this:


    When first aplying selection, and then save the image - I got an image with dimension 1819*2399 pixels.

    Even if I tried to adjust the custom selection to 1821*2401, it didn't help.
    Last edited by stefan; 07.02.2009, 04:32 PM.
    If it hurts not to drint, don't waste the bottle then.

    #2
    How big is the original image? I cannot reproduce the problem on an image that is plenty big enough to allow for that size of crop at that offset.
    Before you post ... Edit your profile • IrfanView 4.67 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpMore SkinsFastStone CaptureUploads

    Comment


      #3
      I think I see what he's getting at. Try reducing your offset by 1 pixel. You may be running up against the edge, and IV can't crop beyond the edge of the image.

      Comment


        #4
        No problem reproducing the error.

        1. Open an bmp-file, in my case it's grey-scale, 250 "colors" and original dimensions in my case is 2799x3845 (but happens not only to that specific image file).

        2. Zoom out to get the image fit screen. I used Ctrl+ mouse wheel to zoom. (I guess error occurs only when zoom is not 1:1.)

        3. Make a custom selection. In this very case, offsets values where 11, 12 and size of selection was 1800x2400.

        4. When selection is placed in main window, I crop image to selection. Now lower left corner yelds 1802x2398 to me.
        If it hurts not to drint, don't waste the bottle then.

        Comment


          #5
          I think you answered your own question in para 2. In general you will only get the exact image size you set if the image is zoomed to 1:1.
          It appears that Create custom selection just sets up a selection box on screen with the edges as close as possible to what you set. The edges can only be drawn along lines of pixels on the screen though, so unless the image is 1:1 that will usually result in slight positioning errors. You can see what has actually been set in the dimensions shown on the caption bar at the top of the screen and those are the dimensions that you will crop to.
          The solution is to set the required size in Custom selection, Save the values and Cancel. Press Ctrl+H to zoom to 1:1, then Shift+C to bring Custom Selection back. Now if you Apply to Image you will get the exact size you want.
          Annoying, I know, but that is the way it works.

          Comment


            #6
            Originally posted by Mij View Post
            ... The solution is to set the required size in Custom selection, Save the values and Cancel. Press Ctrl+H to zoom to 1:1, then Shift+C to bring Custom Selection back. Now if you Apply to Image you will get the exact size you want.
            Annoying, I know, but that is the way it works.
            Thanks, that't a nice go around.
            If it hurts not to drint, don't waste the bottle then.

            Comment


              #7
              Originally posted by Mij View Post
              The solution is to set the required size in Custom selection, Save the values and Cancel. Press Ctrl+H to zoom to 1:1, then Shift+C to bring Custom Selection back. Now if you Apply to Image you will get the exact size you want.
              Annoying, I know, but that is the way it works.
              Usefull, but why in old versions it's work fine in fit to desktop and now everytime i need to switch 1:1 for precise? Why it's not a bug?
              (2 years before I used v4.00, I'd like that “bug” with auto adjust color, when it's applied always for whole image, and can't understand why now it's only for selection: http://en.irfanview-forum.de/vb/show...43&postcount=7)
              Last edited by Kailuz; 16.07.2009, 03:49 AM.

              Comment


                #8
                I thought it had always been the same, but several people have now said that it used to work OK in older versions.
                Can you tell me what version you must go back to where it did work?

                Comment


                  #9
                  It did do it in previous versions, but maybe to a lesser extent. If you're working on a large screen, that can make a difference. Window size, image size, display option, and thus zoom, make the difference. Try resizing your window so an image loads around 10% zoom. Using select all (CTRL+A), look in the caption bar (title bar) at the selection. Most likely it will not match your image! You might have to play with the image and/or window size to see the error.

                  It's not completely a bug, but I agree there could be a little improvement mades. You see, it is more complicated than you think. When drawing on a fitted image, you are not able to access all the image pixels, only screen ones. Several pixels are being represented by one screen pixel, so you get jumps in values available. Inevitability, there will be rounding and boundary issues when trying to determine where you intended your selection to be. Pixels are exact, but scaling is not, so approximations are necessary. Drawing is simply always poor. Defining a selection numerically is the superior method, but lacks any feedback, so far from ideal. Therefore, drawing wins, despite its inherent flaws, because it's user friendly. There really are no great ways around this limitation. Understanding this, you try to draw in 1:1 if absolute precision is needed.

                  Comment


                    #10
                    I'm tried as you say and yes it is. After all, in new version I found that “Custom selection” wrong only when it “Fit to desktop”, but in “Properties” I set “Zoom step: 30%” and “Zoom method: Fixed value” for it. In other methods it's always wrong. Now it's fine (precise) in any zoom but not in Fit to desktop. In old v4.00 it's ALWAYS fine.

                    Comment


                      #11
                      Yes. Fixed value zoom steps are a lot better than the other methods in this respect. I often press the - key after opening as fit to window to step down to the nearest Fixed value. It usually is not much smaller.
                      Some fixed zoom values are better than others (when 100% is too big to use). Clearly 50% is a good choice for sizes that are even numbers and 25% is good for multiples of 4.

                      As Skippybox says the way that IrfanView works at present is to set the selection box on screen to as near as possible the custom values and then use those rounded values for subsequent cropping.
                      That is clearly not satisfactory for some people. Although I agree that the on-screen representation of where the crop will be does have to be an approximation at random zoom ratios other than 100%, there seems no good reason why the figures set in custom selection could not be retained and used for cropping if no on-screen dragging or resizing takes place before the crop is done.

                      I thought maybe that was how older versions worked since some people seem to be certain that it used to be OK.

                      Comment


                        #12
                        Originally posted by Mij View Post
                        Yes. Fixed value zoom steps are a lot better than the other methods in this respect. I often press the - key after opening as fit to window to step down to the nearest Fixed value. It usually is not much smaller.
                        Some fixed zoom values are better than others (when 100% is too big to use). Clearly 50% is a good choice for sizes that are even numbers and 25% is good for multiples of 4.
                        While there may be some truth to that, it rarely works in practice. The problem is pictures vary in aspect ratio, and aspect ratio is almost never 1 unedited. Many images are 4:3, 3:2, and 16:9 nowadays, so width and height are never both multiples of 2, 3, or 4. That is why you will almost always have a problem with zoom.

                        I think a mechanism change might be needed. Obviously now, editing is dependent on a selection (either drawn or applied). Maybe the custom crop selection dialog should offer a third logical button called Crop. That would allow you to bypass the typical apply method, and directly crop the original size image according to the exact coordinates displayed, similar to batch conversion would. It would still offer all the same functionality now, but let you quickly and accurately crop.

                        Only thing is, people would need to find it. But, that might be a good thing, because the program could open the custom selection dialog automatically for you, if you press crop but have no selection.

                        Comment


                          #13
                          Originally posted by Skippybox View Post
                          While there may be some truth to that, it rarely works in practice. The problem is pictures vary in aspect ratio, and aspect ratio is almost never 1 unedited. Many images are 4:3, 3:2, and 16:9 nowadays, so width and height are never both multiples of 2, 3, or 4. That is why you will almost always have a problem with zoom.
                          I think that you are wrong there Skippybox. The 3 cameras in my house are all 4:3 ratio and have image sizes of 1600x1200 (2MP), 3072x2304 (7MP) and 3648x2736 (10MP). All those widths and heights are multiples of 16. I think that is chosen because of the Jpeg compression algorithm. As a result 50% and 25% zoom give exact crops when you choose sides that are multiples of 2 or 4 pixels respectively.

                          However allowing cropping direct from the custom selection box may be a good solution. Perhaps the dialog box could also accept the hotkeys Ctrl+Y, Ctrl+C, Ctrl+V and Ctrl+X.
                          Last edited by Mij; 27.08.2009, 02:18 PM. Reason: One number entered incorrectly

                          Comment


                            #14
                            Well for typical camera JPGs, you are right Mij. I was talking about RAW images which can be e.g. 3861 x 2574 pixels (3:2) from the camera. Obviously though, JPG is more prevalent. But then again, some users do convert RAW to JPG, so the problem still can exist I suppose.

                            Comment


                              #15
                              Hello, I maybe did not realize, but when has this bug been fixed?
                              In v4.25 (German) it is still there. E.g. Custom selection of 1000x600px becomes 1000x599px in my case.
                              ~ Wem du es heute kannst besorgen, den verschiebe nicht auf Morgen. (Resident Evil Printwerbung 1997) ~

                              Comment

                              Working...
                              X