0

I have a program that scans text in a bunch of images (each one has a resolution of 4000x6000), it starts by loading these images from their files, it then creates a new Bitmap with the highlighted text. I want the fastest way to store the highlighted Bitmap to a file (I don't really care about compression if it's going to take a long time).

Dtomper
  • 43
  • 6
  • Does this answer your question? [android - save image into gallery](https://stackoverflow.com/questions/8560501/android-save-image-into-gallery) – Japhei Jul 04 '22 at 11:32
  • @Japhei No, they all used compression. Compression makes my code slow, especially PNG (takes around 9000 milliseconds to compress). – Dtomper Jul 04 '22 at 11:38
  • "Compression makes my code slow, especially PNG (takes around 9000 milliseconds to compress)" -- my guess is that you are actually measuring the amount of time it takes to write the compressed data to disk. What is your evidence that the problem is with *compression* and not with *disk I/O*? – CommonsWare Jul 04 '22 at 11:54
  • @CommonsWare I tried using JPEG compression and it only took 600ms so I thought the problem must be with PNG compression. – Dtomper Jul 04 '22 at 11:57
  • 1
    OK, that's not a bad comparison. I am surprised that there is that big of a disparity. And, 600ms seems pretty good for a 72,000,000-byte bitmap (4000 x 6000 pixels x 3 bytes/pixel). Saving the JPEG may be faster than trying to write those raw bytes to disk, even if you had a good way to write those raw bytes to disk. – CommonsWare Jul 04 '22 at 12:04

0 Answers0