Image problem (ImageEdit.dll)

Discussion in 'Questions (Windows Mobile)' started by ExcludeReality, Jul 23, 2009.

  1. ExcludeReality

    ExcludeReality Active Member Licensed User

    I have a small problem with the ImageEdit library.
    I'm not really used to working with image libraries, so my question might have a simple answer.

    I have a picture (1024 x 768) which is set as background for a form (320 x 240).
    I have calculated that the original image is 3,2 times bigger then it is when adjusted to the form size.

    Then when I try to crop the image (Part of the right side), It "croppes" (Is that even a word?) from the original image, instead of the form image.

    Therefore, I crop the wrong area (3,2 pixels wrong to be exact).

    My code:
    Code:
    ImageEdit.LoadImage (Form1.Image)
       ImageEdit.Crop (
    140,0,240,240)
       SideBar.Image = ImageEdit.GetImage (
    "C")
    This does not work either
    Code:
    Bitmap.New1 (AppPath & "\1.bmp"'The original image
       ImageEdit.LoadImage (Bitmap.value)
       ImageEdit.Crop (
    140,0,240,240)
       SideBar.Image = ImageEdit.GetImage (
    "C")
    And finally, the most mathematically correct (?)

    Code:
    Bitmap.New1 (AppPath & "\1.bmp"'The original image
       ImageEdit.LoadImage (Bitmap.value)
       ImageEdit.Crop (
    140 / 3.2,0,240 / 3.2,240 / 3.2'Split each value by 3,2
       SideBar.Image = ImageEdit.GetImage ("C")
    I'm probably just too blind to see the answer :)
     
  2. agraham

    agraham Expert Licensed User

    ImageEdit is probably the wrong library for this. Using ImagLib or ImageLibEx is probably better.

    However

    ImageEdit.Crop (140,0,240,240)
    will give you a resultant image of size 100 x 240 pixels which I suspect is not what you want.

    ImageEdit.Crop (0,0,239,319)
    will give you 240 x 320 pixels from the top left of the image.

    ImageEdit.Crop (784,448,1023,767)
    will give you 240 x 320 pixels from the bottom right of the image.

    Note that the displayed area of a Form on a device is actually 240 x 268 pixels.
     
  3. ExcludeReality

    ExcludeReality Active Member Licensed User

    The reason I use ImageEdit is because I will adjust the brightness of the cropped image, however that part works perfect so I excluded it from my code example.

    But on the subject;
    A 100 x 240 pixels rectangle IS in fact what I want.
    BUT, I want to crop it from the picture that has been adjusted to the form size, not the original (1024 x 768) picture.
     
  4. agraham

    agraham Expert Licensed User

    Why haven't you resized it first then?
    Code:
    ImageEdit.LoadImage (Form1.Image)
       [COLOR=
    "Red"]ImageEdit.Resize(320,240)[/COLOR]
       ImageEdit.Crop (
    140,0,240,240)
       SideBar.Image = ImageEdit.GetImage (
    "C")
     
  5. ExcludeReality

    ExcludeReality Active Member Licensed User

    That's a very good question :)

    It's fixed it now,
    Thanks a lot Agraham.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice