Welcome Guest.   Make a donation to an author on the site November 26, 2014, 08:49:19 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: Png Painter  (Read 4357 times)
Edvard
Coding Snacks Author
Charter Honorary Member
***
Posts: 2,625



View Profile Give some DonationCredits to this forum member
« on: October 28, 2005, 12:44:24 PM »

Ok, let me explain. I am intending this for skinnable button images and etc. in Litestep and other skinnable thingummys, but it'd also work great for webpage graphics or graphic whatevers in general. The first problem is, I am on NT4 which can't handle png alpha channel natively, so I use an Autohotkey script to send a png and a background color to rpng.exe which paints a png on top of my intended background color with alpha-blend, Alt-PrintScreen to capture the window, and open in MSpaint or Ultimate Paint ('cause it handles png's and it's got a funky interface) to snip the graphic out and convert to png bmp or ico from there. Cumbersome to say the least.
Here's the Challenge: to shorten this process.
Sources and binaries for rpng are available at http://www.libpng.org/pub/png/book/sources.html
Hack the source or code your own which will do pretty much the same as rpng.exe But...
send output to file (png,bmp,jpg,etc.) or graphics editor (too many to list)
I've tried simply piping rpng.exe output to a file (rpng.exe > foo.bmp) but to no avail. rpng is intended only as an example thingamabob for coders and it appears they meant it.... Perhaps someone has an idea on how Autohotkey or some similar script prog can simply wait for the window to open and automagically cut out the contents of the window and save it rather than copying a picture of the entire window as Alt-PrintScreen does now.
Logged

All children left unattended will be given a mocha and a puppy.
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: October 29, 2005, 12:51:49 PM »

 smiley I think you can get this done using the command line options of

ImageMagik from http://www.imagemagick.org

or

Irfanview from http://www.irfanview.com/ with the png-plugin.

If not, it is possible to have AutoHotkey remove the border and titlebar of the rpng window using WinSet.

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
Edvard
Coding Snacks Author
Charter Honorary Member
***
Posts: 2,625



View Profile Give some DonationCredits to this forum member
« Reply #2 on: October 31, 2005, 11:30:51 AM »

I have not found imagemagick to be any kind of useful 'cause I never could get the darn thing to work. Exhaustive as the documentation is, I still could not get it to do exactly what I had hoped, but perhaps I should try again. As wonderful an app as IrfanView is, I cannot do what I hope from the simplicity of a command line. I will try the WinSet prog. Stay Tuned!
Logged

All children left unattended will be given a mocha and a puppy.
NoWhereMan
Participant
*
Posts: 23

View Profile Give some DonationCredits to this forum member
« Reply #3 on: October 31, 2005, 12:02:51 PM »

I'm sure with ImageMagick you can do what you need!  Thmbsup
Logged
Edvard
Coding Snacks Author
Charter Honorary Member
***
Posts: 2,625



View Profile Give some DonationCredits to this forum member
« Reply #4 on: November 01, 2005, 12:38:57 PM »

Ok, ImageMagick comes through, but in a way not entirely but almost, intuitively. First, I tried a batch file so I have an editable drop target that would make both pngs and bmp for testing:
(WARNING: the following will make most sense to those familiar with ImageMagick)
[copy or print]
convert.exe %1 -background "rgb(213,204,187)" test.bmp test.png
Ok, the bmp turned out black on the proper background (not good) and the png looked good but there was something... I opened up the png in Ultimate Paint and there was my original png simply pasted on a background with alpha channel so it looked right, but it wasn't what I wanted. I wanted it mapped on the background so there was no alpha channel left, but the transitions to the background present. I tried all kinds of -channel operations and looked at the forums and in TFM stumbled on:
[copy or print]
convert.exe %1 -background "rgb(213,204,187)" -FLATTEN test.bmp test.png
This is supposed to work on multiple images pasted on each other, so I thought I'd try it to 'flatten' my png on the background. TaDa. But the bmp was fuuunnnkkkyyy. Seems as though it was trying to write a 32-bit bmp when I can only deal with 24-bit or less. Tried -colors, -depth, nothing worked. Once again some rummaging around brought up:
[copy or print]
convert.exe %1 -background "rgb(213,204,187)" -flatten +MATTE test.bmp test.png
apparently this had nothing to do with what I wanted to do, but it DID remove alpha channel information completely, so my bmp was properly 24-bit. Also, I discovered that the alpha channel HAD to be removed before the -colors option did anything. So now I have my batch code
[copy or print]
convert.exe %1 -background "rgb(213,204,187)" -flatten +matte -colors 65536 test.bmp test.png
which can now be imported to a script where I can properly selectify my every whim. Thanks all for the encouragement to stick with IM and when I get a proper code worked up, I'll post it.
Logged

All children left unattended will be given a mocha and a puppy.
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.03s | Server load: 0.08 ]