[wx] Simple image editor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michele Petrazzo

    #1

    [wx] Simple image editor

    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.
  • Cliff Wells

    #2
    Re: [wx] Simple image editor

    On Sat, 2004-10-30 at 11:28 +0200, Michele Petrazzo wrote:[color=blue]
    > 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 :).[/color]

    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 <clifford.wells @comcast.net>

    Comment

    • Jeremy Bowers

      #3
      Re: [wx] Simple image editor

      On Sat, 30 Oct 2004 11:28:35 +0200, Michele Petrazzo wrote:
      [color=blue]
      > Please don't tell me to read the GIMP's source :).[/color]

      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.

      Comment

      • Michele Petrazzo

        #4
        Re: [wx] Simple image editor

        Cliff Wells wrote:[color=blue]
        > On Sat, 2004-10-30 at 11:28 +0200, Michele Petrazzo wrote:
        >[color=green]
        >>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 :).[/color]
        >
        >
        > 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.[/color]

        Ok. I'll divide all my "objects" into a lot of bitmaps.
        [color=blue]
        > 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.[/color]
        I'm using yet both wxPython and PIL. So the work will not be very hard.
        [color=blue]
        >
        > Regards,
        > Cliff
        >[/color]

        Thanks.
        Michele Petrazzo

        Comment

        • Michele Petrazzo

          #5
          Re: [wx] Simple image editor

          Jeremy Bowers wrote:[color=blue]
          > On Sat, 30 Oct 2004 11:28:35 +0200, Michele Petrazzo wrote:
          >
          >[color=green]
          >>Please don't tell me to read the GIMP's source :).[/color]
          >
          >
          > Why read GIMP's source when you can use it?[/color]
          Because I want to understand how it work, not how the user use the tools.
          [color=blue]
          > 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.[/color]

          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.
          [color=blue]
          > Plus, the naive implementations of things like
          > "undo" eat memory for lunch.[/color]
          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

          Comment

          Working...