JPEG => FCML

Non-game-related stuff (beta)

JPEG => FCML

Postby rianbay812 on Fri Aug 16, 2013 11:00 pm

Okay so after a long day of learning how to code I was able to put together a program on eclipse that turns a 500x500 pixel (black and white) JPEG into a FCML code in the form of horizontal stripes.

Here's what I mean:
Image
Full Size

if you have any level suggestions I'd be happy to test it out using this code. But for now, I think this is a cool start and can lead to some great level ideas in the future! I'll try it with big text next.

Here are some test levels
http://www.fantasticcontraption.com/?levelId=619101
http://www.fantasticcontraption.com/?levelId=619104
Last edited by rianbay812 on Sat Aug 17, 2013 7:46 am, edited 1 time in total.
User avatar
rianbay812
 
Posts: 1820
Joined: Sun Feb 22, 2009 5:55 pm
Location: Georgia Institute of Technology: Atlanta, Georgia

Re: JPEG => FCML

Postby Brian3.14 on Sat Aug 17, 2013 4:32 am

that's so awesome O:
you should try to turn pictures from illusions into a FCML code.
User avatar
Brian3.14
 
Posts: 257
Joined: Mon Aug 01, 2011 7:10 am
Location: games are a phenomenal way to feel the rewards we need,without all of the unknown challenges of life

Re: JPEG => FCML

Postby jdccdj1 on Sat Aug 17, 2013 10:20 am

cool idea rianbay!

I think this level was done the same way: http://www.fantasticcontraption.com/?levelId=523508
User avatar
jdccdj1
 
Posts: 824
Joined: Sat Apr 16, 2011 7:59 am
Location: hangin' with Roland of Gilead

Re: JPEG => FCML

Postby rianbay812 on Fri Aug 30, 2013 5:33 pm

I forgot about that level! I'm sure it was, although it probably would have taken a far more artistic mind than me to figure out which areas are black and which are white. Wow okay so that's the bar to beat!

Check this out:
http://fantasticcontraption.com/?levelId=619542
It's obviously not perfect, but kinda cool!

http://www.fantasticcontraption.com/?levelId=619554 this is better!

Although understandably it get's impractical for larger images, this one uses 1993 blocks and it isn't fine tuned yet, can you figure out what it is? haha
Image
Last edited by rianbay812 on Wed Sep 04, 2013 6:29 pm, edited 1 time in total.
User avatar
rianbay812
 
Posts: 1820
Joined: Sun Feb 22, 2009 5:55 pm
Location: Georgia Institute of Technology: Atlanta, Georgia

Re: JPEG => FCML

Postby Brian3.14 on Sat Aug 31, 2013 8:30 am

Mount Rushmore :D Do I get another cookie for knowing this? >:3
must have been very hard
User avatar
Brian3.14
 
Posts: 257
Joined: Mon Aug 01, 2011 7:10 am
Location: games are a phenomenal way to feel the rewards we need,without all of the unknown challenges of life

Re: JPEG => FCML

Postby Pawel. on Sun Sep 01, 2013 2:39 am

Dude how did you code that?
User avatar
Pawel.
 
Posts: 163
Joined: Sat Sep 29, 2012 12:09 pm

Re: JPEG => FCML

Postby marjo on Sun Dec 29, 2013 5:08 pm

Hmmmm... I've been working on a similar project. I think this is a very cool idea, but beyond ghost pieces perhaps an entire level (or at least just the ghost and green pieces) could be painted with a paint program, using different colors for different elements and then converted to fcml. At the beginning it would be in the form of horizontal stripes but later maybe even rectangles could be recognized and converted to one fcml object. I think though PNG to FCML would work better because JPG files are lossy, and colors don't always remain exactly the same when saving, so the program would have to give some leeway to recognize colors beyond black and white. PNGs, on the other hand, I think retain color information much better.
What d'you think?
User avatar
marjo
 
Posts: 378
Joined: Sun Oct 12, 2008 3:56 pm

Re: JPEG => FCML

Postby rianbay812 on Sun Dec 29, 2013 5:55 pm

I converted all images to bufferedimage to work in java anyway. And my program can recognize anything between black and white, you just change the tolerance to whatever you want. If you want it to recognize anything darker than a middle-gray as black, just set the RGB value to like 60 or something. That's how I got the mount rushmore picture to work (though I boosted the contrast in photoshop first).

If you wanted to play around with getting rid of the horizontal stripes, you could research more into vector filetypes and Adobe Illustrator but I don't have the time nor effort especially since I'm not around that much anymore. Since vector types store images as equations of lines, you can use an equation generator to draw lines (I've made a program to do that, and it's not that hard if you can do a teeny bit of calculus but if you are working with code I bet that's not an issue for you). Again, I don't know how vector exactly works, that's your job haha. I look forward to seeing what you can get!
User avatar
rianbay812
 
Posts: 1820
Joined: Sun Feb 22, 2009 5:55 pm
Location: Georgia Institute of Technology: Atlanta, Georgia

Re: JPEG => FCML

Postby marjo on Sun Dec 29, 2013 6:02 pm

Right, vector images would make the process easier, the program would just have to search the image.
What I meant about the image filetype was that let's say you wanted to recognize the color vermilion as rgb(227, 66, 52)
using that color in a jpg would be hazardous because jpgs don't keep exact colors, so your color 227, 66, 52 may turn into a similar but not exactly the same color in compression, for example 226, 66, 53. Now, the program that was supposed to recognize 227, 66, 52 doesn't realize that those pixels are vermilion because the rgb value of those pixels are slightly off. PNGs on the other hand will preserve that color with the exact same rgb values, so the program can still search for exactly 227, 66, 52 rather than have to search for a color close to it.
User avatar
marjo
 
Posts: 378
Joined: Sun Oct 12, 2008 3:56 pm


Return to Off-Topic (beta)



Who is online

Users browsing this forum: No registered users

cron