3

I'm geting a static google map image into a picturebox, after i'm sending picture in my receipt printer it is almost unvisible.(" if i will print it in a normal inject printer the image looks ok"), I thinl that the problem is 1) In google static map image. 2) Or in my printing method.(Receipt printer is a dot matrix printer i think) Look the examples below: Google map Image Printing Result

Here is the method which i'm taking the image from url:

string urlmaps = "https://maps.googleapis.com/maps/api/staticmap?center='" + str + "'+'" + textBox3.Text + "'+&zoom=18&scale=1&size=415x255&maptype=roadmap&format=png&visual_refresh=true&markers=color:blue%7Clabel:S%7C'" + str + "'+'" + textBox3.Text + "'+";
var request = WebRequest.Create(urlmaps);
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
{
    MapBox.Image = Bitmap.FromStream(stream);
}

Is there any other way to convert it somehow? Or should i use other site for taking my static image?? Is it better to use GMap?

fhnaseer
  • 6,729
  • 16
  • 52
  • 101
daddycool
  • 39
  • 5
  • 2
    I would imagine your problem is that your image is very light so when converting to I assume a one bit per pixel image it can either go black or white. Most of the map is light so ends up being converted to white and only a few bits around the name are dark enough to be considered black. How to fix it I have no idea. I'd probably start off playing with the image manually to work out how to get it to print properly (eg load up GIMP and experiment with darkening it, increasing contrast or anything else) before translating that to an automated process. – Chris Nov 09 '17 at 15:55
  • Have you tried printing the image from another application - maybe straight from a browser for example. If the receipt printer is a dot matrix or thermal printer then it may not be possible to convert very pale colours to print. – PaulF Nov 09 '17 at 15:56
  • yes i tried to print image streight from Windows-Paint(Print Screen from Google map) and from Site directly to my printer. I get the same result – daddycool Nov 09 '17 at 15:58
  • That would seem to rule out the problem being related to 1). What model printer are you using - there maybe some setting that can be used to improve colour to gray scale. – PaulF Nov 09 '17 at 16:01
  • I'm trying Bixolon Sp330. I have use various of printers also. The problem exists in all printers. Also i need to make it work for all printers not only in one model. Some Printers have Dithering-brightness settings but some others not. Thats why its so important to understand why is happening this. I think that it doesnt print the grey color in google map. – daddycool Nov 09 '17 at 16:04
  • Just invert the image? – maccettura Nov 09 '17 at 16:05
  • I don't think you can find maps service that supports two-color-images. You can try to add some filters or change contrast to make it closer to original. – Volodymyr Baydalka Nov 09 '17 at 16:05
  • I used Invert code: https://stackoverflow.com/questions/33024881/invert-image-faster-in-c-sharp. But my printing is full black. Is there any way for converting only grey color i think that this will solve my problem – daddycool Nov 09 '17 at 16:12
  • If you are inverting a very pale image, then it will be very dark - what you may need to do is increase the levels of the rgb values. It may be worth looking at converting it to a [grayscale image](https://stackoverflow.com/questions/21527518/converting-rgb-images-to-grayscale) and adjusting the gray level. You may find that different printers will handle grayscale printing differently (according to the manual your printer has 4 different modes to choose from to get the best image) so it may be difficult to find a universal solution. – PaulF Nov 09 '17 at 17:17
  • Solved by invert image and playing too much with image's brightness-Darkness – daddycool Nov 09 '17 at 21:32

0 Answers0