Would you like a Windows GUI interface for IM

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Alan Hadley
Posts: 48
Joined: 2010-03-31T12:17:55-07:00
Authentication code: 8675308

Would you like a Windows GUI interface for IM

Post by Alan Hadley »

I do not know if this is the correct place to post this but here goes. I would like to know if there would be an interest in a winders GUI for many of the features of Image Magic.

I am using IM to load and save files in the new version of CombineZ that I am working on. In fact I have added many other functions from IM, including Cropping, Distortions, Contrast Gamma and other adjustments, Drawing and painting, along with a whole bunch of others that are easy to impliment like flipping and flopping etc. and Auto Gamma etc. I intend to go on adding to this feature list.

The User Interface is unusual to say the least, but it works :-). Basically you have an input and an outpiut pane, and a magnified view of a portion of each. And there is also a treeview control that lists all loaded frames. There is a root node of the tree to which you add functions. Once a function is added you can set it's input arguments then run the function. Functions can be put into function lisats, and a whole list can be run like a single function. Functions and function lists can be named, e.g. you could have two versions of the IM drawing function one called 'Red Circle' and another called 'Green Square'. This is why I avoided the traditional menu system, a menu usually has only a single version of each function.

Coordinates and colours can be entered into function arguments simply by clicking on a picture, thus you could place a circle where you want by clickung, or use the general distortion by clicking on the control points. I have also included a slider control for thingts like brightness.

My next step is to link up the Muparser to allow variables to be used for any input arguments.

Before I ramble on any more my question is would there be much interest here in my project. The user interface uses the .NET framework version 4 and all of the work is done in a Windows .DLL file.

Alan Hadley
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Would you like a Windows GUI interface for IM

Post by magick »

  • Before I ramble on any more my question is would there be much interest here in my project
The ImageMagick developers are primarily Linux developers. We've been waiting for years for a Windows developer to contribute a GUI for ImageMagick. We are very interested in your project and if all goes well we could even include it with the ImageMagick Windows binary distribution assuming you have a academic and commercual friendly license and we review / approve the project. Let us know when you are ready to release it so we can download it and give it a try.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Would you like a Windows GUI interface for IM

Post by Bonzo »

That sounds very interesting Alan; currently I either use a batch script or more often php via a localhost on my PC.

I thought about a GUI before not that I would know how to create one in Windows but was looking at doing something using php. There are so many options for each operator and so many operators it would need some thought on what to include.
I pressume you would include the main operators concerned with photo manipulation?

Off topic: I used Combine ZP last month and was very impressed by the results as have other people I have shown them to. I had a bit of a problem with the inital menu locking my PC up but when I used the advanced menu all worked OK.

One thing I noticed was the artifacts? at the edge of the photos after they have been stacked ( see below ) is this the sort of thing that can be removed in your new version with Imagemagick?

Image
Alan Hadley
Posts: 48
Joined: 2010-03-31T12:17:55-07:00
Authentication code: 8675308

Re: Would you like a Windows GUI interface for IM

Post by Alan Hadley »

Thank's for your feedback both.

I thought the idea would be attractive to a wider audiance than just the CZ one. I will post further when I have a more complete program for testing.

I am starting with the IM features that do things to images, I will get round to exif data and stuff like that later. When the IM parts are more complete I will add the CZ machine code routines.

Yes you can crop in the new version of CZ, the artifact you mentioin is there by design and is easy to remove, even on the old version of CZ. You are right about there being a lot of settings. My solution is to have one or more argument entries under each function entry in the tree control. When you open an argument a dialog appears with all the paramketers, some options in dropdown lists, so you don't have to remember all the key words, and some as numbers (or maths expressions).

A good example of this argument aproach is the 'Distort' function, it has three arguments, the first brings up a single dropdown list where you choose the distortion method. The second is different for each distortion method, e.g. an array of coordinates for some methods and numbers or things like angle, scale, offset for others. The last argument to distort brings up a dialog where you can set options that are the same for all distortion methods, e.g. the background colour, virtual pixel method etc. You will be able to save functions, and sequences of functions to disk, i.e. you can build up a library of functions, like the CZ macro system only more powerful.

As to what functions I will include, the list is growing, so far I have

// Geometry group
L"Distort",
L"Vertical Flip",
L"Horizontal Flip",
L"Leading Diagnoal Flip",
L"Trailing Diagonal Flip",
L"Quarter Size",
L"4 Times Bigger",
L"Chop",
L"Shave",
L"Crop",
L"Extent",

// Colour group
L"Auto Gamma",
L"Auto Level",
L"Normalize",
L"Equalize",
L"Enhance",
L"Despeckle",
L"Add Noise",
L"Adjust BrConGam",
L"Adjust BrSatHue",

// Draw group
L"New Image",
L"Paint",
L"Draw",
L"Composite",
L"Filter with Kirnel",

// convert group
L"Frame to Maplist",
L"Maplist to Frame",
L"Map to Pyramid",
L"Pyramid to Map",
L"Map to DFT",
L"DFT to Map",

Most are IM functions, Paint is my own, as are all of the convert group. (the list above is extracted directly from the code, so sorry about the decoration.) Some of these have live preview, so you move a slide and see the result immediately.

Provided you have the deligate programs such as dcraw installed you can open many different file formats, and save in many too. Right clock and choose 'Load, Right click and choose 'Save' and you have converted the image format. Drag the edges in over the image and you have cropped it, mark a couple of points and you can straighten an image etc.

I have also included a tool that lets you draw construction lines over an image, setting points for the distortion function becomes easier with this. I have had a bit of fun setting a bunch of points in the same place on the source and destination images then moving a few on the destination and using the 'Sheperds' distortion method, (now I must add a way to get a quick preview of the result, and you'll be able to distort in real time).

The program will only work on 64 bit machines at the moment, with lots of RAM as it uses 16 bit quanta.

Alan Hadley
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Would you like a Windows GUI interface for IM

Post by Bonzo »

The program will only work on 64 bit machines at the moment, with lots of RAM as it uses 16 bit quanta
I only have a 32 bit version :(

Thinking about it I had a problem a couple of years ago with CR2 files and Imagemagick - from memory something that Imagemagick needs was dropped from DCRAW?

The program is looking good and I like the idea of the dropdowns although I do not use the distorts much its a pain trying to remember how they work!
Alan Hadley
Posts: 48
Joined: 2010-03-31T12:17:55-07:00
Authentication code: 8675308

Re: Would you like a Windows GUI interface for IM

Post by Alan Hadley »

Re. the CR2 problem, I had a sinilar problem with some test images I downloaded off the web, all I got when loading was a thumbnail of the full image, and an error message. A bit of detective work showed that there was an unrecognized tag in the file. My solution is to detect this and rename the .cr2 to another file type, and I don't know why but that seems to work:-()

As regards 32 bits I want to write the fastest possible routines I can for the CZ part and in 64 bits you have access to twice as many CPU registers, both for general instructions and SSE floating point. So I am not promising to do a 32 bit version, and if I do it won't be for a while yet.

I am going to go quiet now, I have a lot more coding and development work to do!

Alan Hadley
jcupitt
Posts: 26
Joined: 2011-04-26T05:14:01-07:00
Authentication code: 8675308

Re: Would you like a Windows GUI interface for IM

Post by jcupitt »

This is a little off-topic, but I help maintain a cross-platform image-processing GUI called nip2:

http://www.vips.ecs.soton.ac.uk

It's only a little work to link nip2's menus to ImageMagick commands. I made a blog post about it:

http://libvips.blogspot.com/2011/04/nip ... agick.html

Perhaps this might be an easy way to make an ImageMagick GUI?
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Would you like a Windows GUI interface for IM

Post by whugemann »

When developing a GUI for ImageMagick, you should take a look on AvsP, *the* editor for AVIsynth scripts, which nicely demonstrates how a GUI editor can simplify matters. To my taste, a GUI interface to ImageMagick should function pretty much like AvsP.

But I rather think that an OS-dependent GUI doesn't make too much sense. Couldn't such an editor be developed independently of the OS by using, say, QT?

Wolfgang Hugemann
Wolfgang Hugemann
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Would you like a Windows GUI interface for IM

Post by NicolasRobidoux »

NIP2, the VIPS GUI, is based on GTK+ (the GNU cousin of Qt). 32-bit VS 64-bit is a non-issue with NIP2.
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Would you like a Windows GUI interface for IM

Post by whugemann »

I've just had a look at NIP2, and it looks like one possible approach to the problem. (It also seems to offer a solution for another of my problems, i.e. handing a region selection over to IM.)

I though would expect an IM GUI to be more like a programming editor that allows to instantly run the script, show its result and offer help on the various command line options. This is exactly what AvsP offers for AVIsynth's video processing language: Image

I would expect that an IM GUI simplifies common tasks:
  • * store the script before running it
    * display the result (possibly with the original in an extra pane)
    * offer help on the various command line options (by linking to the Internet)
    * link to Anthony's Usage examples
    * assist me in choosing the coorect values, say for the -crop option
AvsP is also GPL, written in Python, using the wxPython graphical user interface framework. Perhaps it could be combined with Scintilla (http://www.scintilla.org).

Wolfgang
Wolfgang Hugemann
Alan Hadley
Posts: 48
Joined: 2010-03-31T12:17:55-07:00
Authentication code: 8675308

Re: Would you like a Windows GUI interface for IM

Post by Alan Hadley »

Just to update you all, here are a few things that I have managed to do so far, it will be a while yet before I have something for testing though.

1. A quad display of the images being processed that consists of two whole images in the lower two panes and an enlarged view of a portion of each in the upper panes.

2. A seperate floating dialog, that can be hidden, which lists the loaded frames, and functions and variables etc. in the form of a tree view.

3. Functions are added using a simple menu system. When necessary functions, and images etc. have properties which can be set in a dialog on demand. This means for instance you could have two Draw functions one that draws a square and another a circle, these can each have their properties set independantly, e.g. colour, size position, stroke etc. These functions can be named indipendantly e.g. "Red Circle", "Blue Square", and you can use variables when setting their properties. So you can set position to x and y and change the values of x and y to draw the same shape in different places.

4. When setting properties you can click on one of the pictures to enter the coordinates of a point, or the RGB values of a colour.

5. There is a 'Construction Device' with which you can draw construction lines over an image to aid in the accurate positioning of points and finding angles and lengths etc.

6. Images and functions etc. can be placed into named lists. Function lists can be saved and reloaded at will. Image lists for animations and stacking etc. have just been added. I still have plenty of work to do on these lists, utility functions to be added for things like looping and conditional execution of functions etc. A whole function list can be 'Run' to perform a complex operation.

7. I am in the process of adding the main IM drawing functions etc. Setting up things like Distorts becomes much easier using the construction tool and clicking on the images.

8. Generally the panes on the left of the screen show the original frame and those on the right the result of an operation. The properties dialog has a slider control so if updateing is quick enough you will see a live preview of settings such as gamma, saturation, brightness etc. on the right side.

9. Where necessary drop down lists of key words are used so you can click on one instead of typing it, or look one up if you forgot it.

10. some functions still use commandline style input but the majority have a seperate field in their properties dialogs for each value. In some case the properties dialog grows as you add more points etc. The most complex one so far looks like a spreadsheet with x,y,R,G,B,A and a dropdown list button that changes colour with RGB values on each line, if you make an entry on the empty line below the form grows so you can add as many points and colours as you like.

11. A few selected operations such as cropping streightening and aligning can be done without the need to set functions up to do them.

As I mentioned above I still have a lot of work to do before things are ready for initial testing. I am using the ,NET framework 4 for the I/O portion of the application. The link between this and IM is in a .dll file and written in C++ using a minimum of windows library functions. This .dll in placed in the IM instalation folder so it can call the IM functions. I am using the Magick Core functions.

Alan Hadley
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Would you like a Windows GUI interface for IM

Post by fmw42 »

Not to put your effort down as any GUI would certainly be nice, but I would agree with others that a cross-platform environment would be a lot better, such as QT or NIP2, etc.
Alan Hadley
Posts: 48
Joined: 2010-03-31T12:17:55-07:00
Authentication code: 8675308

Re: Would you like a Windows GUI interface for IM

Post by Alan Hadley »

I am not an expert on crossplatform coding but the front end of my code is written in C#/.NET and is quite small. It asks the main .dll questions like "How many functions do you know?" then "Tell me about the first one", "...the second one"etc. Then it puts the info it gets into a simple standard array. When it wants a function running it just sends the .dll a handle and waits for the result, if this is a picture it displays it etc.

Of course there is more to it than the above simple overview but it should be relatively easy to rewrite the front end in another language, say Java, and recompile the .dll for any other platform, I think the only windows specific functionality in the .dll is the DllMain function, and perhaps a few data types.

In principle it should be possible to compile for 32 bit machines also but I intend to add some additional functionality used in focus stqacking, e.g. the Pyramid transform which I will write in 64 bit SIMD code for speed and to take advantage of the larger address space available on windows.

Alan Hadley
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Would you like a Windows GUI interface for IM

Post by whugemann »

I think there's more to it than just calling functions in a DLL. Ideally, the frontend should reproduce the look and feel of the OS it's running on. (Including simple things like the OK bottom placed at the *right* bottom of the dialog box on Apple computers.) And C# and .NET is *really* MS-specific, although there might be work-arounds on other OSs. And I don't have a 64 bit computer either, as I have to run 16 bit legacy software every day.

Anyway, I am imagining a frontend that is more like an IDE. As a start, it could take a single Convert command line, hand it over to IM and display the result (or -- for beginners more probable -- the error message). It should make suggestions for parameters and link to Anthony's Usage examples.

I have just read a little about wxWidgets in Wikipedia and would suggest to give a modification of the AvsP code a try, which would probably be a rapid approach to the problem.

I would contribute some time to such a project, say about two weeks of real work. (I have a real job eating me up already.) We would need a team of about 3 -- 5 persons on the long run. I have coded (Windows) GUIs in C/C++/Pascal in Visual C and Borland Pascal years ago. I don't know anything about Python so far, but it sounds cool. (Well, anything is better than C.)

As Alan seems to be heading for something different, I don't see this in concurrency to his project.

Wolfgang Hugemann
Wolfgang Hugemann
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Would you like a Windows GUI interface for IM

Post by NicolasRobidoux »

I think that you could have something decent running with 2-3 solid weeks of NIP2 programming.

I believe that it is easy to fix the NIP2 interface so that it shows the IM command that's being generated by the GUI. In other words, it would not quite be an IDE: It would generate (and run) a correct IM command line consistent with the GUIzed options, which the "knowledgeable" user could then directly tweak (and break) by adding yet more options.

There is another advantage to using NIP2: It loads images taking the color profiles and color spaces into account (for a few common image formats). Consequently, this would remove a common barrier to the use of IM for some users: you'd get IM commands in an environment that handles colorspace issues automatically.

Contact jcupitt hat gmail dot com, or reply to him through this forum (he left a post above) if you want to explore this possibility. He's the NIP2 expert.

(And, unlike me, he's not pushy.)
Post Reply