View Single Post
Old 10-29-2010, 02:00 PM   #2
r0b1n
Junior Member
r0b1n began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2010
Location: Ukraine
Device: Kindle 3 Wi-Fi
I think you can try to find "raw" plugin/converter for GIMP or Photoshop. But still little chance of finding a suitable program for these purposes...

I quick wrote dirty Python scripts for convert BIN<->BMP (gray-scale 1byte per color).






Spoiler:

bmpToBin
Code:
#!/usr/bin/python

import Image

width = 600
height = 800

bin_file = "dkswitchmenu_new.bin"

bmp_file = "image.bmp"

# open bmp
im = Image.open(bmp_file)

# open bin 
f = open(bin_file, "wb")

for i in range(240000):
    
    c1 = im.getpixel((i*2%width,i*2/width))
    c2 = im.getpixel(((i*2+1)%width,(i*2+1)/width))
    
    # to 1 byte
    r = (c2 >> 4) | c1
    
    #second - i*2+1
    f.write(chr(r))

f.close()
binToBmp
Code:
#!/usr/bin/python

import Image

width = 600
height = 800

bin_file = "dkswitchmenu.bin"
bmp_file = "image.bmp"

im = Image.new("L", (width,height))

f = open(bin_file, "rb")

for i in range(240000):
    # read from file and put into image
    
    # read 1 byte
    r = ord(f.read(1))
    c1 = (r & 0xF0) >> 4
    c2 = (r & 0x0F)
    
    # first - i*2
    im.putpixel((i*2%width,i*2/width),c1 << 4)
    
    #second - i*2+1
    
    im.putpixel((  (i*2+1)%width,(i*2+1)/width),c2 << 4)
im.save(bmp_file)
f.close()

Last edited by r0b1n; 10-29-2010 at 05:01 PM.
r0b1n is offline   Reply With Quote