Android Question Problem with my code: touchimageview and rsimageprocessing

Sub7

Active Member
Licensed User
Longtime User
Hello!
i am tryng to understand why my image change his scale after processing it with rsimageprocessing lib, the image dimensions does not change after processing.

If i comment this part of the code the image stay exacly where it should be.
B4X:
Dim ChangeColor As RSImageEffects
LoadImageFromGallery = ChangeColor.SepiaToning(LoadImageFromGallery,0,0,0,0)


But if i run this code the result is a small zoomed out image:

B4X:
    Log(LoadImageFromGallery.Width& " " &LoadImageFromGallery.Height&"BEFORE")

    Dim ChangeColor As RSImageEffects
    LoadImageFromGallery = ChangeColor.SepiaToning(LoadImageFromGallery,0,0,0,0)

    Log(LoadImageFromGallery.Width& " " &LoadImageFromGallery.Height&"AFTER")
  
    SourceImageRect.Initialize(0, 0, LoadImageFromGallery.Width, LoadImageFromGallery.Height)
    TouchImageViewRect.Initialize(0, 0, TouchImageView1.Width, TouchImageView1.Height)
    TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
  
    Log(LoadImageFromGallery.Width& " " &LoadImageFromGallery.Height&"POST")
    TouchImageView1.SetBitmap(LoadImageFromGallery)

What's wrong gurus? :)
 

Sub7

Active Member
Licensed User
Longtime User
This appen with MESgraphix too so the problem is not what i use to process the image but another, which is dunno for me.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
is the last line required?

B4X:
TouchImageView1.SetBitmap(LoadImageFromGallery)

doesn't that reload the original picture again instead of putting the scaled one inthere?
 
Upvote 0

Sub7

Active Member
Licensed User
Longtime User
Hi,
I take a picture from the camera, save it to a temp folder for some reasons,
open the image and process, update the image on the touchimageview.
That's why i am reloading, but even if i create a new (Dim processedBMp AS Bitmap )file this happen.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
maybe you should post your solution so that others know what to do if they have a simular issue.
 
Upvote 0

Sub7

Active Member
Licensed User
Longtime User
False alarm, the problem not solved and is in the last line of first block of code
B4X:
Activity.AddView(TouchImageView1, 0, 0, Panel2.Width, Panel2.Height)
TouchImageViewRect.Initialize(0, 0, Panel2.Width, Panel2.Height)'Questo imposta l'area dove puoi spostare l'immagine
TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
SourceImageRect.Initialize(0, 0, ???,???)
i need that to be the same size of a panel and zoomable in/out but if i try this:
B4X:
SourceImageRect.Initialize(0, 0, panel2.width,panel2.height)
i get a small image if i process with rs, else i get everything working.
 
Last edited:
Upvote 0

Sub7

Active Member
Licensed User
Longtime User
This code work:
B4X:
SourceImageRect.Initialize(0, 0, LoadImageFromGallery.Width, LoadImageFromGallery.Height)
    TouchImageViewRect.Initialize(0, 0, TouchImageView1.Width, TouchImageView1.Height)
    TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
    TouchImageView1.SetBitmap(LoadImageFromGallery)

This code does not, (small image)

B4X:
    SourceImageRect.Initialize(0, 0, LoadImageFromGallery.Width, LoadImageFromGallery.Height)
    TouchImageViewRect.Initialize(0, 0, TouchImageView1.Width, TouchImageView1.Height)
    TouchImageView1.ScaleSrcRectToDestRect(SourceImageRect, TouchImageViewRect, "CENTER")
    Dim ChangeColor As RSImageEffects
    Dim bitmap20 As Bitmap
    bitmap20 = ChangeColor.SepiaToning(LoadImageFromGallery,0,0,0,0)
    TouchImageView1.SetBitmap(bitmap20)

Really dont know, sad.
 
Upvote 0
Top