Small Text on Canvas Gets Blurry

bherrington0421

Member
Licensed User
Longtime User
Hey guys,

I'm working on a project in which I am using Google Cloud Printing to print some really small text (around size 6). Because limitations of Google Cloud Printing, the way we have to do it is passing in an image. So, we are just using DrawText on a canvas and then saving it out as a jpeg so we can pass it to the cloud. However, in printing it, we notice that the result is pretty pixelated and doesn't have the sharpness that we would hope for.

Is there any way around this that anyone knows of? Somehow making the canvas higher quality with more pixels or something. Not sure... Thanks!
 

bherrington0421

Member
Licensed User
Longtime User
That seems to be working if I just view the canvas or if I send it to Google drive. It isn't unbearably pixelated when I view it there but as soon as it is sent to the printer it gets blurry again... I'm sure that it isn't Google Cloud Print that is causing this. Would writing onto the bitmap with a larger font and than scaling the bitmap work any better? Any other ideas? Thanks so much.
 
Last edited:
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
I know it's not the printer because I can print size 6 font fine from Microsoft Word and it isn't blurry. I'll try the scaling and post back here. Let me know if there are any other options please. Thanks for your help.
 
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
What I said about the sharpness when I view it on Google Drive is incorrect. I think that it is just a little easier to read. The scaling is not going to work. I think the reason this is happening might be because I am saving the bitmap to a compressed image file type (PNG/JPEG). However, WriteToStream on a bitmap only accepts one of those two.
 
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
Attached is the image being generated from my code. As you can see, it doesn't look too blurry, but as soon as I print it, everything just blurs a little bit. Also, I am noticing that the display of the jpeg compared to the size of the text when I print isn't exactly the same... When I print and compare it to the image in an image viewer, the text on the paper is a little bigger, but if it is somehow being stretched I'm not sure how... The size of the bitmap in pixels shouldn't make a difference correct?

I also see that if I create a png in paint of the same font and size, it prints a little bit pixelated, but not as bad. It also seems to print of a different size than when I print from my app, even though I'm passing the same size and font.

Not sure what else to try. Any other ideas of how to pass this text to Google Cloud through an image that might be higher quality/improving my current idea would be appreciated.
 

Attachments

  • Sample.png
    Sample.png
    2.1 KB · Views: 467
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
Yes, I tried scaling the bitmap. I drew it with a larger font (12 or so), and then tried scaling down to what seemed comparable to font 6. The result was very much so the same or worse.

Does it matter where I set the antialias flag? I set it once right before I draw.

Edit: My project is also requiring that I use drawBitmapFlipped to simulate a mirroring of the text. I am noticing that the text is much more pixelated when this function is called as opposed to when it is not and the bitmap is left alone.
 
Last edited:
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
I believe that the nature of the bitmap is going to be blurry and there seems to be no way around it unfortunately. Are there any other features in B4A where I can draw text onto an image and save it that might have a different result than a bitmap? Could the way I initialize my canvas or bitmap make a difference?

The antialias suggestion doesn't seem to make any difference at all.
 
Upvote 0

bherrington0421

Member
Licensed User
Longtime User
Awesome! That made the text much more readable. One last jab at trying to make this even better, is there any way to increase the dpi resolution of the image being saved other than the quality parameter in WriteToStream? Thanks again!
 
Upvote 0
Top