Hi,
I am loading a 645px / 1011px / 300 dpi with at printable size as 5,45x8,56cm image as a imageview.
When I save it again with Canvas1.Bitmap.WriteToStream(out, 100, "PNG") the size has changed to 967px / 1516px / 72 dpi with at printable size as 34,11x53,48cm
When I there after resize the image to 5,45x8,56cm the quality is very poor.
Is there a way to control the image dpi?
I need better resolution than 72dpi because I need to print the image
Mogens
I am loading a 645px / 1011px / 300 dpi with at printable size as 5,45x8,56cm image as a imageview.
When I save it again with Canvas1.Bitmap.WriteToStream(out, 100, "PNG") the size has changed to 967px / 1516px / 72 dpi with at printable size as 34,11x53,48cm
When I there after resize the image to 5,45x8,56cm the quality is very poor.
Is there a way to control the image dpi?
I need better resolution than 72dpi because I need to print the image
Mogens
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Dim ImageViewPinCard As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
Dim Canvas1 As Canvas
Dim Bitmap1 As Bitmap
Dim smaller As Bitmap
Canvas1.Initialize(ImageViewPinCard) 'this canvas will draw on the activity background
Canvas1.DrawTextRotated("Pincode: 1234567", 150dip, 250dip, Typeface.DEFAULT_BOLD, 18, Colors.Black, "CENTER", -90)
Bitmap1.Initialize3(Canvas1.Bitmap)
'Smaller = ResizeBitmap(Bitmap1, 210, 330)
Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal, "Test.png", False)
'smaller.WriteToStream(out, 100, "PNG")
Canvas1.Bitmap.WriteToStream(out, 100, "PNG")
Out.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ResizeBitmap(original As Bitmap, width As Int, height As Int) As Bitmap
Dim new As Bitmap
new.InitializeMutable(width, height)
Dim c As Canvas
c.Initialize2(new)
Dim destRect As Rect
destRect.Initialize(0, 0, width, height)
c.DrawBitmap(original, Null, destRect)
Return new
End Sub