[wx] Simple image editor

Discussion in 'Python' started by Michele Petrazzo, Oct 30, 2004.

  1. 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.
     
    Michele Petrazzo, Oct 30, 2004
    #1
    1. Advertising

  2. Michele Petrazzo

    Cliff Wells Guest

    On Sat, 2004-10-30 at 11:28 +0200, Michele Petrazzo wrote:
    > 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

    --
    Cliff Wells <>
     
    Cliff Wells, Oct 30, 2004
    #2
    1. Advertising

  3. On Sat, 30 Oct 2004 11:28:35 +0200, Michele Petrazzo wrote:

    > 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.
     
    Jeremy Bowers, Oct 30, 2004
    #3
  4. Cliff Wells wrote:
    > On Sat, 2004-10-30 at 11:28 +0200, Michele Petrazzo wrote:
    >
    >>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.


    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
     
    Michele Petrazzo, Nov 2, 2004
    #4
  5. Jeremy Bowers wrote:
    > On Sat, 30 Oct 2004 11:28:35 +0200, Michele Petrazzo wrote:
    >
    >
    >>Please don't tell me to read the GIMP's source :).

    >
    >
    > 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
     
    Michele Petrazzo, Nov 2, 2004
    #5
  6. Michele Petrazzo wrote:
    > ... 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
     
    Scott David Daniels, Nov 2, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    716
    Stylus Studio
    Aug 3, 2004
  2. Hatem KNANI
    Replies:
    2
    Views:
    672
    Morphon Technologies
    Aug 4, 2003
  3. Stylus Studio
    Replies:
    0
    Views:
    504
    Stylus Studio
    Aug 3, 2004
  4. SyncRO Soft
    Replies:
    0
    Views:
    514
    SyncRO Soft
    Jul 21, 2005
  5. SyncRO Soft
    Replies:
    0
    Views:
    507
    SyncRO Soft
    Sep 21, 2005
Loading...

Share This Page