Jump to content




Load Bitmap image


  • You cannot reply to this topic
7 replies to this topic

#1 bobster71

  • Members
  • 36 posts

Posted 05 December 2012 - 04:20 PM

Hi

I've been trying to find a way of loading a bitmap file or any image file and reading the rgb for each x,y. I'm not famuliar with the file structure and am getting stuck. Could anyone write me a small routine to load a bitmap please.

thanks
Bobster

ps - if I can get this working, I can show you something cool. Otheriwise it wont be as cool, but check computercraft on minecraft forum for pic and vid later.

This is my code I've been trying to use.
Spoiler


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 December 2012 - 04:38 PM

I believe this is what you're looking for.

#3 faubiguy

  • Members
  • 213 posts

Posted 05 December 2012 - 04:47 PM

A while ago I was creating a program for exporting a color tags image to a BMP file, but it wasn't working so I gave up on it after a few hours. I don't know if any of the code would be useful for you, but if you want you can use any of it.

Spoiler


#4 bobster71

  • Members
  • 36 posts

Posted 05 December 2012 - 04:48 PM

View PostLyqyd, on 05 December 2012 - 04:38 PM, said:

I believe this is what you're looking for.

yeah I found that too, but I'm not that good a programmer. I have worked out some,but not all. Added my code to my post too.
I have saved bmp useing paint and photoshop they all come up with NOT A BMP file.
I'm doing something wrong but not sure what.

#5 kazagistar

  • Members
  • 365 posts

Posted 05 December 2012 - 04:48 PM

View Postbobster71, on 05 December 2012 - 04:20 PM, said:

Could anyone write me a small routine to load a bitmap please.
No. I am pretty sure no one could, because loading a bitmap is an non-trivial process. So you could make a long and complicated routine to do it, in theory.

#6 bobster71

  • Members
  • 36 posts

Posted 05 December 2012 - 04:50 PM

View Postfaubiguy, on 05 December 2012 - 04:47 PM, said:

A while ago I was creating a program for exporting a color tags image to a BMP file, but it wasn't working so I gave up on it after a few hours. I don't know if any of the code would be useful for you, but if you want you can use any of it.

Spoiler

Thanks it might be what I need.

UPDATE: I tried it, I can't get it to work either. Its a clever idea, I had the same idea but never got around to doing anything about it.

#7 faubiguy

  • Members
  • 213 posts

Posted 06 December 2012 - 03:19 AM

Even if I did get it to work, and reversed it so it read instead of wrote, it would only work for reading one type of BMP. When I coded it I didn't intend to release it. It might be easier just to write something up without using that code.

#8 bobster71

  • Members
  • 36 posts

Posted 06 December 2012 - 09:59 AM

Hey

I didn't end up getting it to load a bitmap or any pic, but I'll work on it. Maybe gif or another format might be simpler, I'll look into it and let you lot know. Anyway here's a vid of what's I've done so far. It doesn't show any pics only a red gradient but you get the idea of what I"m trying to do.



What do you think? I tried doing a laser display when CC first came out, but this is full rgb.
I've also seen a better laser display, with 16 (I think) colors but they had the same prob I did, the lasers were buggy.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users