Hi, i m using canvas to make a crop with rect
this works outputstream JPEG quality 100
ok image save normal but i have one problem with witdh and height
this is the code
the OpenOutput image is saved with
width = 720
height = 1220
why this? i tested on another devices and tablets and save with the same width and height
why this?
can i set witdh and height when i go save the image on WriteToStream(out, 100, "PNG") ?
for exemple
WriteToStream(out, 100, "PNG". witdh = 100 , height = 100 )
this works outputstream JPEG quality 100
ok image save normal but i have one problem with witdh and height
this is the code
B4X:
Sub btaprova_Click
If salvouprimeira = False Then
Dim cvs As Canvas
cvs.Initialize(TouchImageView1)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize3(TouchImageView1.TransformedBitmap)
Dim SrcRect As Rect
SrcRect.Initialize( cropimg.Left , cropimg.Top , cropimg.Left + cropimg.Width ,cropimg.Top + cropimg.Height)
Dim DestRect As Rect
DestRect.Initialize(0%x,0%y,100%x,100%y)
cvs.DrawBitmap(Bitmap1,SrcRect,DestRect)
Dim out As OutputStream
Dim filename As String
filename = "Thumbnail.png"
out = File.OpenOutput (fp, filename , False)
cvs.Bitmap.WriteToStream(out, 100, "PNG")
out.Close
If File.Exists(fp, "Thumbnail.png") Then
imgamostra.Bitmap = LoadBitmap(fp, "Thumbnail.png")
cropimg.SetLayout(25%x, menu.Height, 75%x - 25%x, 80%y)
salvouprimeira = True
TouchImageView1.Color = Colors.Black
End If
Else
Dim cvs As Canvas
cvs.Initialize(TouchImageView1)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize3(TouchImageView1.TransformedBitmap)
Dim SrcRect As Rect
SrcRect.Initialize( cropimg.Left , cropimg.Top , cropimg.Left + cropimg.Width ,cropimg.Top + cropimg.Height)
Dim DestRect As Rect
DestRect.Initialize(0%x,0%y,100%x,100%y)
cvs.DrawBitmap(Bitmap1,SrcRect,DestRect)
Dim out As OutputStream
Dim filename As String
filename = "Background.png"
out = File.OpenOutput (fp, filename , False)
cvs.Bitmap.WriteToStream(out, 100, "PNG")
out.Close
If File.Exists(fp, "Background.png") Then
bgamostra.Bitmap = LoadBitmapSample(fp, "Background.png", bgamostra.Width, bgamostra.Height)
TouchImageView1.Color = Colors.Black
painelconfirmafoto.Visible = True
painelconfirmafoto.BringToFront
cropimg.SetLayout(25%x, 35%y, 50%x, 30%y)
salvouprimeira = False
btaprova.Visible = False
btrecusa.Visible = False
btaprovar.Visible = True
btrecusar.Visible = True
btrecusar.BringToFront
btaprovar.BringToFront
End If
End If
End Sub
B4X:
filename = "Thumbnail.png"
out = File.OpenOutput (fp, filename , False)
cvs.Bitmap.WriteToStream(out, 100, "PNG")
out.Close
the OpenOutput image is saved with
width = 720
height = 1220
why this? i tested on another devices and tablets and save with the same width and height
why this?
can i set witdh and height when i go save the image on WriteToStream(out, 100, "PNG") ?
for exemple
WriteToStream(out, 100, "PNG". witdh = 100 , height = 100 )