Page 1 of 1

Need some help.

Posted: Thu Jan 31, 2008 5:40 pm
by Destron
Hey, I want to create a (somewhat) simple procedural texture editor. I don't know a whole lot about programming (just how to create a "hello world" console app :roll:), but I know I can't just jump and and know how to do this.
That said, what's a good language to learn for this? I mostly want to combine existing images, rather than add in, say, a perlin noise or sine generator, although I may eventually do that.
I was thinking something like Visual Basic (although this is shunned by a lot of programmers).
What do you guys think?

p.s. - some features I would like to include:
- BMP Export
- Image Blending Modes (Add, Subtract, Multiply, etc)
- Misc "simple" filters (e.g. colorize, blur, etc)

Re: Need some help.

Posted: Thu Jan 31, 2008 8:14 pm
by Allanon
Might try using the Python Programming Language. It is very easy to use and it has a lot of 3rd party libraries such as the Python Imaging Library which makes it very easy to manipulate images.

Here is an example of how easy it is, after loading Python and the Python Imaging Library just open up any word processor and enter the following code:

Code: Select all

# load libraries
from PIL import Image
from PIL import ImageChops

# load images
im1 = Image.open("test1.jpg")
im2 = Image.open("test2.jpg")

# merge images
im3 = ImageChops.multiply(im1, im2)

# show the image 
im3.show()

# save the image
im3.save("test3.jpg")
Save the code as test.py. Make sure you have 2 JPEG images named test1.jpg and test2.jpg in the same folder as test.py. Then run the program by double clicking on test.py. The program will load test1.jpg and test2.jpg then merge them in to a new image. Then the program will display the new image using Windows default image viewer. Once the image viewer is closed the program will then save the image to the name test3.jpg.

If you read the documentation to the Python Imaging Library you will see how easy it is to do all kinds of other image manipulation tricks. I just started using python a few days ago because someone ported the Tivo HME SDK over to it and I have found Python to be easy and a joy to work with.

Re: Need some help.

Posted: Thu Jan 31, 2008 8:31 pm
by jonas
Nice :D I love Python. I didn't think about it being used for image manipulation... That could be fairly simple. I haven't played with it a lot, but is it fairly simple to create win32 applications with python alone, or do you still need to create a c++ program and call the python binary or can you do it just straight python?

Re: Need some help.

Posted: Thu Jan 31, 2008 9:06 pm
by Destron
I forgot about Python!

Thanks a lot Allanon, I'll check those out. :)
That could be fairly simple. I haven't played with it a lot, but is it fairly simple to create win32 applications with python alone, or do you still need to create a c++ program and call the python binary or can you do it just straight python?
I'm not sure... I guess I'll have to look into that.


EDIT: Whoa, this stuff really works! I'll have figure out how to implement it with a GUI and stuff.

Re: Need some help.

Posted: Thu Jan 31, 2008 10:38 pm
by Allanon
I never did GUI programming with Python until now. I picked EasyGUI from the list of many Python GUI frameworks mostly because of the name. After a little reading of the documentation I was able to rewrite the above sample with a GUI and a little more functionality. This sample works with almost any kind of popular image format and you can save to any popular format just by using the correct file extension when saving.

Code: Select all

# load libraries
from PIL import Image
from PIL import ImageChops
from easygui import *

# load images
file1 = fileopenbox("choose image 1", "Choose Image", "*.*")
file2 = fileopenbox("choose image 2", "Choose Image", "*.*")

im1 = Image.open(file1)
im2 = Image.open(file2)

# blend the images
choice = choicebox("How do you want to blend the images", "Blend Images", ["Multiple","Difference","Add","Subtract" ,"Screen","Darker","Lighter"])

if choice == "Multiply":
    im3 =ImageChops.multiply(im1, im2)

if choice == "Differance":
    im3 =ImageChops.difference(im1, im2)

if choice == "Add":
    im3 =ImageChops.add(im1, im2)

if choice == "Subtract":
    im3 =ImageChops.subtract(im1, im2)

if choice == "Screen":
    im3 = ImageChops.screen(im1, im2)

if choice == "Darker":
    im3 =ImageChops.darker(im1, im2)

if choice == "Lighter":
    im3 =ImageChops.lighter(im1, im2)

# show the image 
im3.show()

# save the image
file3 = filesavebox("Save the image","Save Image", "*.*")

im3.save(file3)
See how easy it is! :)

Re: Need some help.

Posted: Thu Jan 31, 2008 10:50 pm
by jonas
wow...Going to have to give python the tripple thumbs up! Very nice...I can see why andycr mentioned using this for rf2. :D

Re: Need some help.

Posted: Fri Feb 01, 2008 1:47 am
by Destron
Thanks, Allanon, I really appreciate it... this'll help me out a lot! :)

Re: Need some help.

Posted: Fri Feb 01, 2008 1:57 am
by zany_001
you could try Java 2 too, its got quite good imagemaking stuff with it.