GIMP Chat http://gimpchat.com/ |
|
Image to bit map file http://gimpchat.com/viewtopic.php?f=8&t=18478 |
Page 1 of 1 |
Author: | twisted67 [ Sun Jun 21, 2020 10:11 am ] |
Post subject: | Image to bit map file |
GIMP Version: 2.10.20 Operating System: Windows OS Version: 10 GIMP Experience: New User URL or Image link: https://eater.net/downloads/finch.bin List any relevant plug-ins or scripts: from PIL import Image image = Image.open("finch.png") pixels = image.load() out_file = open("finch.bin", "wb") for y in range(256): for x in range(128): try: out_file.write(chr(pixels[x, y])) except IndexError: out_file.write(chr(0)) List any ERROR messages you received: Traceback (most recent call last): File "<input>", line 1, in <module> ImportError: No module named PIL Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'Image' is not defined Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'image' is not defined I have this script that should make a bit map file of an image, but it was made for Photoshop. How do I do the same thing but with GIMP? If any of you are familliar with an EEPROM... I want to make a bit map that the pixels can be read horizontally (lowers address values A0-A6). The lines would be vertical and would be addressed by the higher values (A7-A13) I would really want a suitable 200x150 image to be converted to above format. The image I linked is an example image but its 100x75. I have a video link if you see the guy do the stuff in Adobe to know what exactly I am talking about |
Author: | mahvin [ Sun Jun 21, 2020 11:52 am ] |
Post subject: | Re: Image to bit map file |
Why would you post a bin file? Why not just screenshot the bin when you have it open on your end, and then convert it to jpg or png? |
Author: | twisted67 [ Sun Jun 21, 2020 11:58 am ] |
Post subject: | Re: Image to bit map file |
Sorry. Here is the png not bin. I grabbed the wrong link. |
Author: | Nidhogg [ Sun Jun 21, 2020 12:15 pm ] | |||
Post subject: | Re: Image to bit map file | |||
Image/Mode/Indexed/Black & White 1-bit?
|
Author: | twisted67 [ Sun Jun 21, 2020 12:48 pm ] |
Post subject: | Re: Image to bit map file |
Hm. How do i get the raw pixel data? And write it to a new file? (BIN) I think thats what I am trying to ask. I want to load the picture into an EEPROM...no file information should be saved. |
Author: | rich2005 [ Sun Jun 21, 2020 2:03 pm ] |
Post subject: | Re: Image to bit map file |
The png file needs to be in indexed mode and maybe only 64 colours Use Image -> Mode -> Indexed and set the number of colours This using linux. I have no idea how PIL is installed in Windows However, with file and script in a folder, edit the script to suit file names / image size. Run the script and it outputs the .bin file. best of luck |
Author: | twisted67 [ Sun Jun 21, 2020 2:25 pm ] |
Post subject: | Re: Image to bit map file |
Thanks. I figured out that I just need to install Python to run the script. For some reason I thought Photoshop came with the ability to do what Ben Eater did. Kinda stupid. |
Author: | rich2005 [ Mon Jun 22, 2020 3:08 am ] | ||
Post subject: | Re: Image to bit map file | ||
In case OP ever comes back. Looking on the eater.net/ site the conversion to Indexed mode uses a color palette "64-color.act" Not a format that Gimp uses. Not difficult to manually re-write to .gpl format. (attached) Unzip then 64-color.gpl goes in C:\Users\"yourname"\AppData\Roaming\GIMP\2.10\palettes Conversion Image -> Mode -> Indexed Set the palette. Set one of the dither modes. Export as a png. Example:
|
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |