DBPro / Anyone fancy a REAL challenge? (Image Magick) |
| Author | Message | ||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
Imagemagick (http://www.imagemagick.org/script/index.php) is a set of open source image processessing functions, with massive potential. It can convert images from any format to any other (including svg vector graphics images that can be scaled indefinitely with no loss of quality), and it can do pretty much anything with an image that photoshop can do, including image manipulation, vector drawing and text rendering (with antialiasing) and batch processing. It has a wrapper for pretty much every language out there - except for DBPro. It looks to me like something that would be a huge improvement on the 2d image features currently in DBPro. Hands up who would like a piece of that! So, all we need is someone with the know how and the enthusiasm, to wrap it for dbpro. There is already a high level wrapper for C called Magickwand, and a wrapper for C++ called Magick++, either of which could easily (probably) be converted into a dll for DBPro by someone who knows how. I'd have a go at it myself, except for the fact that a) it's a bit over my head and b) it won't build with the two free compilers I have (Dev C++ or VS 2005 express) - apparantly it only works with the full version of Visual Studio or Borland (something about needing the Microsoft Foundation Class or somethigorother ...) Anyone interested? |
||
| Back to top |
|||
|
vorconan
User Joined: Sat Nov 4th 2006 Location: Wales |
Sounds awesome, I'd love to see someone do it |
||
| Back to top |
|||
|
BatVink
TGC Newsletter Editor ![]() ![]() Joined: Fri Apr 4th 2003 Location: Chilling |
|
||
| Back to top |
|||
|
Zotoaster
User ![]() Joined: Mon Dec 20th 2004 Location: Scotland |
I would have done it, but the whole needing the full version of Visual Studio draws me back a bit "It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers |
||
| Back to top |
|||
|
IanM
Moderator ![]() Joined: Wed Sep 11th 2002 Location: In my moon base |
I have that, but it's the size of the API that bothers me - there's just so much to wrap, it's unreal. The fact that I have PSP8 with scripting built in also makes it seem less worthwhile. Even the free GIMP has scripting (if you don't like the scheme language, plug perl or python into it instead). It's also unlikely that this library will run fast enough to provide real-time effects, though I guess it may be useful for utilities. So, why is it needed, and how much of it? |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
It is a big api and wrapping the whole thing would take a considerable time investment. I also agree, that the speed of doing image processessing would make this more useful for an application than for real time effects in a game. But, then, DBPro is advertised as an application builder (It has "write incredible 3d games, applications and presentations" written on the box!) I also have a feeling, that applications written in dbpro have possibly had, and have the potential for more commercial success than games. With something like BlueGUI and an Imagemagick plugin, you could write all sorts of applications that involve or output 2d grahics. Let's say someone wanted to write an application that creates, or allows the user to create textures or images - perhaps a small program to create buttons for website graphics. Just wrapping the readimage and writeimage methods alone would allow the program to load and save images into any image format (gif format would probably be useful for them). Alos, as Batvink said, drawing and scaling images in the svg format would allow you to output images from your application of any size, with no loss of quality. Well that's just me - lets see how much interest this thread gets - perhaps other people would have other uses? If anyones interested, here's my thread on the imagemagick forum, where I have experimented a little, like Batvink, with the call dll command: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=9190&sid=6d3ee0f3517027716ae9ca4ee19398ef |
||
| Back to top |
|||
|
vorconan
User Joined: Sat Nov 4th 2006 Location: Wales |
|
||
| Back to top |
|||
|
BatVink
TGC Newsletter Editor ![]() ![]() Joined: Fri Apr 4th 2003 Location: Chilling |
The best use I can describe is user graphics. For example, allowing a user to add their own photo, avatar or logo to a game. Which is better... Option 1: Please use a bmp, png or jpg file that is exactly 300 x 300 pixels Option 2: Select any image. For best results,ensure it as at least 300 x 300 pixels |
||
| Back to top |
|||
|
RUCCUS
User Joined: Sat Dec 11th 2004 Location: Canada |
Ian you could always start on it and post your work. When you get tired of it, someone else might pick it up for a bit seeing as it's on it's way. After a few months of different people working on it, it'll be done. Theres tonnes of C++ Wizards on devhat, maybe they'd have a crack. ![]() |
||
| Back to top |
|||
|
Crit
User Joined: Wed May 24th 2006 Location: Cyberspace |
Ric, maybe try initializing the call to magickreadimage with the path to the dlls. result=call dll(1,"MagickReadImage",magick_wand,"[path to imagemagic dlls]"); Quote: "
Please note that under Windows (and possibly the Mac) it is necessary to initialize the ImageMagick library prior to using the Magick++ library. This initialization is performed by passing the path to the ImageMagick DLLs (assumed to be in the same directory as your program) to the InitializeMagick() function call. This is commonly performed by providing the path to your program (argv[0]) " in c++, argv[0] is the path to your program search for argv[0] here: http://www.imagemagick.org/script/magick-wand.php http://www.imagemagick.org/Magick++/ |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
I am No expert on this, but I know that jinzai as a lot knowledge on doing something like this, if you look at the One wire weather station project or jinzai how to find your IP address this may give you some clues on what you may need to do to get the plug in working. One wire weather station project and finding IP address code. http://forum.thegamecreators.com/?m=forum_view&t=107388&b=1 hope this might show how to call some of the API and get someone going. Dark Physics makes any hot drink go cold. |
||
| Back to top |
|||
|
IanM
Moderator ![]() Joined: Wed Sep 11th 2002 Location: In my moon base |
Quote: "Ian you could always start on it and post your work"
Ok, I'll take a look and see how best to wrap it.I still need to know what people want to get out of it though. The only concrete requirement so far is 'load an image', and maybe 'resize an image' from Batvink, but that just scrapes the surface of what this library can do. This is high-level from the web-site's front page: * Format conversion: convert an image from one format to another (e.g. PNG to JPEG) * Transform: resize, rotate, crop, flip or trim an image * Transparency: render portions of an image invisible * Draw: add shapes or text to an image * Decorate: add a border or frame to an image * Special effects: blur, sharpen, threshold, or tint an image * Image calculator: apply a mathematical expression to an image or image channels * Text & comments: insert descriptive or artistic text in an image * Image identification: describe the format and attributes of an image * Animation: create a GIF animation sequence from a group of images * Composite: overlap one image over another * Montage: juxtapose image thumbnails on an image canvas * High dynamic-range imaging: accurately represent the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows * Large image support: read, process, or write mega- and giga-pixel image sizes * Threads of execution support: ImageMagick is thread safe and many internal algorithms are already threaded to take advantage of speed-ups offered by the dual and quad-core processor technologies. If it's just 'load an image', that's dead easy. If more is required then that may affect how the functionality is wrapped up. |
||
| Back to top |
|||
|
BatVink
TGC Newsletter Editor ![]() ![]() Joined: Fri Apr 4th 2003 Location: Chilling |
* Format conversion: convert an image from one format to another (e.g. PNG to JPEG) Good for unsupported formats * Transform: resize, rotate, crop, flip or trim an image rotate, crop, flip and trim can be done in DBP. But Resize in DBP gives poor results. * Transparency: render portions of an image invisible Already available through colorkey and alpha * Draw: add shapes or text to an image Available to a degree. Cloggy's D3D does nice antialiased text, and we can add basic shapes * Decorate: add a border or frame to an image Not rocket science to do in DBP * Special effects: blur, sharpen, threshold, or tint an image Would be nice * Image calculator: apply a mathematical expression to an image or image channels Must have a thousand uses, if it's generic * Text & comments: insert descriptive or artistic text in an image Not sure what uses this would have * Image identification: describe the format and attributes of an image Is this necessary? * Animation: create a GIF animation sequence from a group of images We have animated sprites already * Composite: overlap one image over another Nice * Montage: juxtapose image thumbnails on an image canvas Not really necessary * High dynamic-range imaging: accurately represent the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows For Skyboxes? * Large image support: read, process, or write mega- and giga-pixel image sizes Could be useful |
||
| Back to top |
|||
|
vorconan
User Joined: Sat Nov 4th 2006 Location: Wales |
|
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
These are the aspects that I think would provide the most benefit for a general range of uses. Where I have made reference to actual functions, I'm referering to the Magickwand api for C, found here: http://www.imagemagick.org/script/magick-wand.php There would also need to be a number of functions included for general functionality - things like changing stroke colour, creating/destroying/rendering 'wands' (from what I understand, wands are like separate images which can be named, and combined together - there are three varieties - magick wands, for image effects, drawing wands for vector drawing, and pixel wands for things like changing ink colour.) Also, for the Magickwand api at least, you need the functions 'MagickWandGenesis' and 'MagickWandTerminus' to inialise and terminate the process. I think Ruccus has a good point - if someone like Ian would be willing to at least start this off, then I think that's probably the most difficult part. Once the framework is in place, anyone with a suitable compiler should be able to add functions reasonably easily, if the project is left open. |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
Ric, to be honest I have avoided your thread because I was all about getting GUIStudio, but my income has prevented that. Besides, I have yet to create the experiments to finish my DSP project. I did find this guy that built a sonar much like the one I'm building, but alas, I lost the link! Now, the other reason is that I, ahem am owing someone some updated code from last week. Unfortunately, I recently developed a personal life which is keeping me away from more purely intellectual pursuits. Of course I'd like to see that wrapped for use with DBPro. The process, while lengthy and a little tedious, is not onerous by any stretch. As HowDo pointed out, I have done alot of that type of work. I use VisualC++ 2003, which is a pretty complete system for working with DBPro. I will get up to speed and open an interface to the dll the same way I always do. That will at least produce a set of source files. I want to point out that Microsoft Foundation Class is still available to those using third party compilers. You only lack the include files, and they are included along with the documentation on how to use them in the Platform SDK. (You know, I am going to start asking Bill for money when I put that pitch in for him.) |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
Okay, that was alot of downloading and circular webpage navigation to find out that I could just use Standard Operating Procedures. After all of that, and some digging, I got told to copy the demo project files... The function call that is required is called InitializeMagick. All it does is tell the core where the dlls are at. (AAAARRRRGGGHHHH! For over 15 years this has worked exactly the same way!) DLLs that are not plug-ins should be put in the application's directory (actually the worst choice, imo), Windows directory (outstanding choice), or Windows system directory (really only for drivers, and Windows components, but alot of low-level dlls are in there from alot of companies.) I put all of the DLLs into c:/windows, and I naturally wrote as the first function in the plug-in: int InitImageMagick(const char* lppath) It is called from DBPro like this: temp = InitImageMagick("c:/windows") Now, this function calls the constructor of my class that will contain collections of each of the classes that ImageMagick exposes. They will be numbered on the DBPro side, just like other DBPro entities (e.g. objects, images, sounds, etc.) + Code Snippet The DLL contains one global pointer to the jzImageMagick wrapper class, and will expose access to it through DBPro-callable functions. At some point, I will write [again!] code to search for the DLLs. I'd rather say forget it, if they are not in the three directories that any brain-dead application gets searched for free, they are probably not there, but...Mom said to be nice. For now, I am going to handle it on the DBPro side by passing the correct answer in that string, since it works. I can provide a framework that should be able to be used with most any compiler. The settings are not especially tricky. Paths to the include files, and libraries, along with library dependencies are the only new things. A standard plug-in stub suffices for starters. The only real tricky part of this type of thing is setting up templates for using the C++ Standard Template Library, and that has already been done in the case of Magick++. Should have some functionality by mid-week. |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
|
||
| Back to top |
|||
|
Zerk
User Joined: Sat May 13th 2006 Location: Orbiting Jupiter |
Sounds like Ric wants some work done for free? zParticle BETA finally released! An advanced particle system plugin for DBP! More information and Download link! |
||
| Back to top |
|||
|
BatVink
TGC Newsletter Editor ![]() ![]() Joined: Fri Apr 4th 2003 Location: Chilling |
|
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
Quote: "Sounds like Ric wants some work done for free? "
I'm not after anything for free - if someone wants to make this into a plugin and charge for their time, that's entirely up to them. However, as Imagemagick is open source, they may well think that the aim of this kind of project is more about benefiting the community. As BV said, there are rewards in life other than money - kudos, appreciation, respect ...... |
||
| Back to top |
|||
|
Ron Erickson
Moderator ![]() ![]() Joined: Fri Dec 6th 2002 Location: Pittsburgh, PA, USA |
If I wasn't up to my ears in projects already, I'd love to take this one on. Good luck to whoever decides to run with it. -Ron ![]() |
||
| Back to top |
|||
|
IanM
Moderator ![]() Joined: Wed Sep 11th 2002 Location: In my moon base |
@jinzai, If you are taking this on, great - I can be doing other things. Have you tried looking into compiling the library as a static library instead of a DLL? That way you'll avoid any DLL conflicts (now or in the future - there are products that already use the library), or people forgetting to include the DLLs with any distribution of their code. |
||
| Back to top |
|||
|
Vidiot
User Joined: Mon May 15th 2006 Location: NJ |
I wish I could offer to help. But this is way over my head. All I can say is I really could use a high quality image resize function that can operate from within DBPro. Thats the one thing about my Digital Signage app that I'm not satisfied with. I tried different methods in DBPro and they produced very different results depending on the original image. Some would look perfect after a resize and others would look lousey regardless of the original's size. Personally, I'm more of a graphics guy than a programmer so I'd likely be interested in ANY new graphic functions. If you want someone to help with testing this as it develops, I'd be glad to. I have Corel Draw and Photoshop so I can access ALOT of different image types. The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic. |
||
| Back to top |
|||
|
Xolatron
User Joined: Sun Mar 12th 2006 Location: The Star Forge Language: DBpro |
This looks really nice, and I'd be glad to see a DBp wrapper. Image conversion would be nice (since DBp doesn't support GIF images or interlaced jpegs) As to the dlls, I find it's easiest to have the exe extract them on runtime and then call them, so only the exe file has to be distributed. I usually have one dirblock file and extract it to a "temp" folder in my app's directory. As far as images go, though: In the meantime, I use binkconv.exe (Search for "Bink" on Google, download, install, and copy binkconv.exe & radutil.dll to your program's directory) to convert images - it could also resize them with high-quality. Here's the function source code (it requires binkconv.exe and ratutil.dll in the program's directory): + Code Snippet Bink is free to download and distribute, but your program should display the bink logo somewhere. For more information, see the Bink website. I've tried all the image conversion tools I could find, and however odd it is to call an exe file, it seems to work the best so far. It'd be nice to have the full range of files in ImageMagick supported and in dlls (rather than akward exes), though. -Xol |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
|
||
| Back to top |
|||
|
Xolatron
User Joined: Sun Mar 12th 2006 Location: The Star Forge Language: DBpro |
I've never gotten a DOS window using DBpro's "execute file" command, but that code uses a ShellExecuteA call to shell32.dll and tells it to suppress any pop-up windows, so it should be fine. Perhaps replacing 'execute file' with this would help: + Code Snippet The 0 parameter at the end of the call tells shell32 to make the call invisible. The mouse sometimes turns into a half-timer (both pointer and timer - I don't know how else to describe it), though. I'm interested to know why a DOS window appears when you normally call ImageMagick from the command line, since 'execute file' works without any console window for me - the exe specified simply runs as usual. Does this problem happen if you try to execute notepad.exe from DBpro, for example? I resorted to the shell32 call above because the Bink Converter usually brings up a progress window (but for images this is so fast it's useless). The "/#" parameter allows this console to disappear without user input, so it doesn't invisibly slow down the CPU either. -Xol |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
Quote: "I'm interested to know why a DOS window appears when you normally call ImageMagick from the command line, since 'execute file' works without any console window for me - the exe specified simply runs as usual. Does this problem happen if you try to execute notepad.exe from DBpro, for example?"
No - it seems to be specific to Imagemagick - I don't know why, I think it's just designed that way. I'll try your alternative using shell execute - that may work out better. Still no substitute for a proper dbpro interface, though. |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
IanM - well, I am working with it. I think that is a great idea...I much prefer static linking for this type of thing. I D/L'ed all the source, as well. that was alot of downloading! Certainly, any other thoughts that occur to you would be most welcome. Right now, I am using a thin wrapper class that uses STL vectors. It works well so far. I hope that I can post something soon. We can discuss why its crap then, and fix it! ...and I am on a somewhat coerced holiday in St. Louis right now. I brought the machine, but...haven't gotten 'tound to setting it up here...perhaps tomorrow - still sightseeing...St. Louis is a great midwestern city! |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
Okay, I have the 21 projects running along in lockstep. The ImageMagick Windows source is unevenly documented, but fortunately it is so over-complete that I was able to wrestle it into my way of doing things; so far, so good. A few notes to anyone else wanting to work this way...you have to do a couple of things to create proper libraries for use in the DBPro DLL project. First of all, in the ImageMagick configure project, you must edit magick-config.h.in and #undef ProvideDllMain. The project you want to configure is VisualStaticMTDLL. In addition to that, you will want to manually edit every library project and specifically ignore the libraries msvcprt.lib and libcmt.lib. (You can right click in the Solution Explorer window and select the menu item Properties. You set the option on the Librarian tab, under the item Ignore Specific Library.) Now, after that, I move the built libraries up into a folder I created called lib, in the folder ImageMagick-6.3.5 I set my library search path to that in VisualC++, and list the libraries as additional dependencies, and copied the directory structure and include files to my plug-in project directory. Clear as mud, but it works alright for me. There is some include file editing necessary get it all working properly, but this way I can just create one DLL that includes all 19 ImageMagick DLLs as static code and has but one interface to DBPro. That is the idea, anyway. I only have the CoderInfo class working right now because I took my sweet time about getting the toolchain set up on this one. Too many side issues! I had to fix .NET, and that was a chore, but my system is much more stable now. Oh, and yes, I'm still on vacation, as well. Perhaps I will post up something more specific, if anyone is interested in seeing my project files...they are VisualC++.NET 2003 based, but...I think they would work in VisualC++.NET 2005, as well. The ImageMagick source is in the file ImageMagick-windows.zip. After you unzip it, you go to the VisualMagick/configure directory, and open the configure project. VS will want to convert the projects, which is okay. This program, once built will make the project files for building the ImageMagick libraries. You configure the project, then open it and clean/make all. There is documentation on this process, but it has the usual Unix/Linux bias, so there are some things that are necessary, but not documented, like I stated above. I am not at all certain that I have found every issue as yet, either. |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
Wow, sounds like a lot of work. Hope you're still enjoying your vacation! Once completed, then, will this just be one dll which goes into the plugin directory? Or will there be a requirement to install additional libraries onto the end users machine, in order to distribute a dbpro exe that uses the plugin? Let me know if I can help out in anyway (eg. documentation?) |
||
| Back to top |
|||
|
MikeS
Moderator ![]() Joined: Mon Dec 2nd 2002 Location: United States |
|
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
Yes, it will be a single DLL with no external dependencies. At first, I thought it might be necessary to distribute X11 DLLs, but they are included in the library source. Then, I was not sure which static library to build/use. In determining the proper build, I came across the other issues I mentioned above. It isn't much work at this point - I am just having the same slow time remembering how we do this sort of thing - combine third party library code with my code to present to the first (or is it second) party? In a DLL, noless. Today, I provided the basic constructors for images and blobs, and discovered that TGA is multiframe, and AVI is not writable from ImageMagick. Not surprising, either one. btw, my answer to the why use a DOS window question is that all of the prebuilt utilities are console projects. My opinion is that this is the same leaning towards Unix/Linux that Open Source multi-platform projects seem to do. There are some other projects included in the Windows source that are not console projects...they are Windows apps. C++ sample and teaching code usually uses this programming method (a DOS, or console window) because it seems simple to the person writing it. True, but...I never liked it, either. ...and yes, the vacation is going well still. |
||
| Back to top |
|||
|
Vidiot
User Joined: Mon May 15th 2006 Location: NJ |
Not to pester, but... Is there anything to test yet? Or did you all move to a new thread? The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic. |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
My bad guys. Yes, there is a pretty complete DLL which I will try to get posted today, or Monday at the latest. Alot is done, and I have documentation, too. Sorry about the delay, I got moved out of my place and still don't heve my belongings back. Might have to get Judge Joe Brown on this one! |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
|
||
| Back to top |
|||
|
Vidiot
User Joined: Mon May 15th 2006 Location: NJ |
Knock, knock... (creeeeeeeeeeek) Hello? Is anyone in there? There's dust on all these posts. And WW Webs on all the routers... I'm scared! LOL. Sorry for the bad humor but I do actually have a question if this DLL is ever completed. Did someone mension this .dll was already "open source"? And does that affect my ability to use a function from it in a application that I intend to sell? @Jinzai, I wish there was a way I could help! The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic. |
||
| Back to top |
|||
|
jason p sage
User Joined: Sun Jun 10th 2007 Location: Ellington, CT USA |
I THINK you can sell stuff that uses it - but in many of the licesne I know of for opensource - you must make the changes to the code that you did available. Not the code to your game - but the changes to the lib to make it work for ya. They're all different though - but that's usually how it goes. |
||
| Back to top |
|||
|
jinzai
User Joined: Sat Aug 19th 2006 Location: USA |
...okay, here it is FINALLY. Sorry again. There is no alpha yet, and the Drawable class is not totally there, but you can do some neat stuff with it. The file is a zip of the directory structure with the Dark BASIC Pro directory being the root. There is a sample project (yes, it totally stinks, but....) and also help and keywords. Thanks to Ric and Benjamin for the examples to follow. Cheers, I hope its useful. Also, I hope to get back online soon. Right now, I am staying with #3 and #1 sons. Its been great, but no Internet. |
||
| Back to top |
|||
|
Ric
User ![]() Joined: Sun Jul 11th 2004 Location: object position x |
|
||
| Back to top |
|||
This is a multi-page thread older than 30 days.
Go to the last page to check if you can reply to it.
Go to the last page to check if you can reply to it.
Forum Search
Enter a word or phrase to search our Forum for:
|
|














