javl / image2cpp

GNU General Public License v3.0
529 stars 156 forks source link

problem with converting pictures #19

Closed KayThy closed 6 years ago

KayThy commented 6 years ago

The image2cpp doesn't work for me I have been trying to convert envelope icon into bitmaps but I get the picture in truncated format. please help or advise me on what I can do. I am using 1-5 and 1-2 monochrome OLED with adafruit ssd1305 libraries

I tried both modes but still no luck. Thank you in advance

img_20180621_111641

javl commented 6 years ago

Judging by your image the image gets converted properly, as the image is recognisable (not weirdly distorted or anything). Can you make sure you're using the actual image size everywhere? Both while converting and when drawing the image?

Are there supposed to be two envelopes and it's drawing two halves, or only one and it is being drawn incorrectly?

KayThy commented 6 years ago

Yes I am using the same size which is 16x11 px It should be a single image so it draws it incorrectly

javl commented 6 years ago

Can you post the image and the relevant part of your code? (Only the part loading and drawing the image)

KayThy commented 6 years ago

include "notification_logo.h"

display.drawXBitmap(4, 54, Notifications, notification_width, notification_height, 1);

the picture below is converted envelope icon so I have created a notification header file.

image

javl commented 6 years ago

You mentioned your image being 16x11 pixels but you seem to be drawing it at 16x9 pixels?

javl commented 6 years ago

Actually, after typing your byte array into the tool I noticed the resulting image is exactly the image show in your photo. I think you might have made some error with the inputs while converting. Can you post your image here so I can try converting it and see if I get the same result?

KayThy commented 6 years ago

I have attached the picture it is 16x11 i don't know how did it happen to appear as 16x9 on your side but it is supposed to be 16x11

On Sat, Jun 23, 2018 at 11:50 AM, Jasper van Loenen < notifications@github.com> wrote:

Actually, after typing your byte array into the tool I noticed the resulting image is exactly the image show in your photo. I think you might have made some error with the inputs while converting. Can you post your image here so I can try converting it and see if I get the same odd result?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/javl/image2cpp/issues/19#issuecomment-399659273, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai1qRwWsnS4XJKu6Ct-1Ry7cn_jrnYGpks5t_g9-gaJpZM4Uzzxt .

javl commented 6 years ago

I mean that you define the image as being 16x9 in your code: selection_487. If this came from the output of image2cpp, it means you didn't specify the canvas size correctly before converting.

Can you please attach the original image you tried to convert? Not a photo of the screen but the .jpg/.png/.bmp file you're using. Also, when adding code please paste the actual code instead of a screenshot. That way I can simply copy paste it to test, instead of having to retype the bytestring from your image.

javl commented 6 years ago

No response for a week so I take it this was a user error. Closing this issue.

KayThy commented 6 years ago

Hi, I actually massaged you on the 25th of June and I have been waiting for your response I just thought to myself that maybe you are probably busy at that time but I can still resend that massage if you haven't received it

On Sun, Jul 1, 2018 at 5:01 PM, Jasper van Loenen notifications@github.com wrote:

Closed #19 https://github.com/javl/image2cpp/issues/19.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/javl/image2cpp/issues/19#event-1710323092, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai1qR7uCaSJz-raCqLRVg-hdT6c23BA1ks5uCOQ-gaJpZM4Uzzxt .

javl commented 6 years ago

I don't see it on this page so I guess something went wrong. Can you post it again, please?

KayThy commented 6 years ago

images i don't know how did i made that mistake though i just corrected it but i still get the same picture. Sorry for that screenshot here is the code below.

define notification_width 16

define notification_height 11

static unsigned char Notifications[] PROGMEM = { 0x00, 0x00, 0x3f, 0xfc, 0x1f, 0xfa, 0x6f, 0xf6, 0x73, 0xce, 0x79, 0x9e, 0x7c, 0x7e, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x80, 0x01};

I'll think that you need an original picture that i got from the internet but this one i didn't resize it but the first picture that i have sent I have resized it to 16x11 px using paint

Thanks

javl commented 6 years ago

I really want to help you, but I can't help if you don't provide the info I ask for. If this is not the image you used before, how can I check if something is wrong with the output of my tool? I can't compare the converted version of this image to your code because you used a different image.

So please, resize this image to whatever size you need, then convert it using the tool and see if the code works. If it doesn't, post your resized image together with the output from the tool. Taking a screenshot of the tool, showing the settings you used will also help.

KayThy commented 6 years ago

notifications

define notification_width 16

define notification_height 11

static unsigned char Notifications[] PROGMEM = { 0x00, 0x00, 0x3f, 0xfc, 0x1f, 0xfa, 0x6f, 0xf6, 0x73, 0xce, 0x79, 0x9e, 0x7c, 0x7e, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x80, 0x01};

Tried it again and still get the same results. The size of the attached picture is 16x11px

javl commented 6 years ago

Hm, the output seems to be correct. When I enter your byte array into the tool I get the image again. Do you have the code for how you're drawing the image? Often when something goes wrong you get a garbled image (like the example at the bottom of the tool) but in your case it seems there is some sort of offset going on. I think this might be due to the way you draw the image.

It might also be useful to try the Adafruit example which you can find over here: https://github.com/javl/image2cpp/blob/master/oled_example/oled_example.ino. First try the example as is (maybe only change it to match your display) and then try again with your image.

KayThy commented 6 years ago

img_20180702_162500

Thank you it now works fine only those 2 pixel from top corner became truncated.

I think the problem was the way I was drawing the picture which was display.drawXBitmap(4, 54, Notifications, notification_width, notification_height, 1);

so I only removed X from display.drawXBitmap to make it display.drawBitmap which makes no sense to me because other pictures I have been drawing them using that code line