kidasov
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2017
05:22 AM
Convert bitmap to png or jpg
I tried to use GetToFile method from here https://sdkdocs.roku.com/display/sdkdoc/ifUrlTransfer#ifUrlTransfer-GetToFile(filenameasString)asInt...
It saves raw bitmap to file. Then I am trying to convert bitmap to png like this and remove file with bitmap.
But the size of file (426x249) is huge according to r2d2_bitmaps.
What I am doing wrong?
It saves raw bitmap to file. Then I am trying to convert bitmap to png like this and remove file with bitmap.
urlTransfer.getToFile(fileName)
bitmapImage = CreateObject("roBitmap", fileName)'
bitmapImage = bitmapImage.GetPng(0, 0, 426, 249)
bitmapImage.WriteFile("tmp:/test.png")
DeleteFile(fileName)
But the size of file (426x249) is huge according to r2d2_bitmaps.
0x27bfdf46 426 249 4 458752 /tmp/plugin/GEAAAAEweoqr/tmp:/test.png
Available memory 50984704 used 9015296 max 60000000
What I am doing wrong?
2 REPLIES 2
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2017
11:05 AM
Re: Convert bitmap to png or jpg
458752 is not the size of the png file, it is the size of it loaded in memory/as a texture (roughly Width * Height * bpp)
kidasov
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2017
07:42 AM
Re: Convert bitmap to png or jpg
Yes. It was my bad. I missed it 🙂 And thank you!