[wx] Simple image editor

M

Michele Petrazzo

I want to create a simple image editor (with wxPython) for my application.
Now I'm able to zoom, draw with a pen, insert a text into the loaded
image, and undo changes (for this I reload the image and redraw all the
lines/text, but not the last.)

My problem is how can I move the texts/lines that are insert into Image,
after placed? How the image editors (like GIMP) are able to move the
objects? Please don't tell me to read the GIMP's source :).

Thanks,
Michele

P.s. I hope you understand me, my English is horrible.
 
C

Cliff Wells

I want to create a simple image editor (with wxPython) for my application.
Now I'm able to zoom, draw with a pen, insert a text into the loaded
image, and undo changes (for this I reload the image and redraw all the
lines/text, but not the last.)

My problem is how can I move the texts/lines that are insert into Image,
after placed? How the image editors (like GIMP) are able to move the
objects? Please don't tell me to read the GIMP's source :).

First of all, if you are talking about bitmaps, then there are no such
things as "objects" in that sense, there is only a big bunch of bits.
What programs like the Gimp do is keep several (possibly hundreds) of
separate bitmaps for each of the objects and then composite them
together to give you a unified view of your "bitmap". So the first
thing you'll need is a framework for managing all those objects. This
should be fairly straightforward in Python. Second, you can use the
built-in wxPython image handling tools or take a look at something like
PIL for doing the compositing.



Regards,
Cliff
 
J

Jeremy Bowers

Please don't tell me to read the GIMP's source :).

Why read GIMP's source when you can use it?

Can you shell out your manipulations, and then just take a changed version
of the image back in?

Of course, any image editor will work then, too.

Maybe not, I don't know your needs. But it is worth thinking about. Image
editors are in the class of applications that you should go to great
lengths to avoid rewriting. To get anything beyond the Paint that shipped
with Windows 3.1 is a major effort, plus unless you really, really know
your users don't want anything but primitive text overlays, you're asking
for an infinite amount of feature requests to add things that other image
editors already have. Plus, the naive implementations of things like
"undo" eat memory for lunch.

Take a look at the *size* of the GIMP, even without the filter plugins.
Are you sure you want to take that job on? Even a subset can get massive,
fast.
 
M

Michele Petrazzo

Cliff said:
First of all, if you are talking about bitmaps, then there are no such
things as "objects" in that sense, there is only a big bunch of bits.
What programs like the Gimp do is keep several (possibly hundreds) of
separate bitmaps for each of the objects and then composite them
together to give you a unified view of your "bitmap". So the first
thing you'll need is a framework for managing all those objects.

Ok. I'll divide all my "objects" into a lot of bitmaps.
This
should be fairly straightforward in Python. Second, you can use the
built-in wxPython image handling tools or take a look at something like
PIL for doing the compositing.
I'm using yet both wxPython and PIL. So the work will not be very hard.
Regards,
Cliff

Thanks.
Michele Petrazzo
 
M

Michele Petrazzo

Jeremy said:
Why read GIMP's source when you can use it?
Because I want to understand how it work, not how the user use the tools.
Can you shell out your manipulations, and then just take a changed version
of the image back in?

Of course, any image editor will work then, too.

Maybe not, I don't know your needs. But it is worth thinking about. Image
editors are in the class of applications that you should go to great
lengths to avoid rewriting. To get anything beyond the Paint that shipped
with Windows 3.1 is a major effort, plus unless you really, really know
your users don't want anything but primitive text overlays, you're asking
for an infinite amount of feature requests to add things that other image
editors already have.

I want to add a simple image editor into my application, that not is an
image editor,but a fax client, so the features of place text/lines are
the only that I need.
Plus, the naive implementations of things like
"undo" eat memory for lunch.
The "undo" work yet correctly.I have three list with:
1) all the points of the lines, ...
2) text, font, color, position, dimensions, ...
3) "l" or "t", that mean line or text.
Every time that I place a line, I append into list 1 all the values and
into list 3 a "l". for the text is the same.
When I press undo button, I pop a value from list 3, and pop a value
from correspondent list. After this I rewrite all the bitmaps.

It work, but if I have a lot of "objects", I must attempt that it redraw
all.

Thanks,
Michele Petrazzo
 
S

Scott David Daniels

Michele said:
... if I have a lot of "objects", I must attempt [to] redraw all.
One simplification that can speed things up tremendously (in the case
that you can ignore write order), is to have a "selected" object, and
an image of "everything else" on which you draw the "selected" object
as you move it around.

-Scott David Daniels
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top