Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

Thread: Tutorial about generating transparent PNG's for use as tokens in a VTT or similar.

  1. #11

    Post

    You've left out a step. Once you have your alpha mask, how do you connect it to your original image to form the PNG?

    Obviously, as a Photoshop user, my interest is merely academic, but I've always been curious about how you get the PNG if your software can't save it that way to start with.

    And since you mentioned Image Magick obliquely in your post, a primer on the use of that utility would not go unappreciated (at least by me), if you have the time someday. I'd really like to get to know it better for the batch processing capabilities.
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  2. #12
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Post

    Yes good point. OK lets hit two birds with one stone.

    To convert a color image file_C.png and an alpha mask file_A.png into an RGBA transparent file.png you can call :-

    composite %1_A.png -compose copy-opacity %1_C.png -depth 8 %1.png

    in a batch file using image magick and pass in the name 'file' as the batch file parameter ( %1 ). Then you can call that batch file from another with a list of files that need converting if you wanted to - which is similar to what I do for Kimmo's character tokens.

    In my app you load them in as a pair - see image - and save out the corresponding file.

  3. #13
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Post

    I was going to post some more about ImageMagick but got distracted for a few hours....

    Image magick is a command line script based set of programs which can manipulate images. There is no user interface so that puts a lot of people off but on the other hand it can be embedded into stuff like this forum for example which Arcana has said uses it to generate some of the attachment icons. Its very widely used if not widely known to be being used if you know what I mean.

    For doing interactive stuff its completely useless but for doing stuff which has to be done time and time again its a strong tool. Gimp and many other apps are now embedding a scripting language into them to be able to do similar stuff so for those people they would stick with the UI launched scripts. But you can get IM on a lot of platforms with a small download and if you can get a command line shell prompt then you have a pretty big image wrench at your disposal.

    There are about 4 commands but most people use just the one. Convert. It was called that because in the old days it used to convert one image file format into another and that was it. Then all the other stuff got added until its now fully featured. But make no mistake about it, even though it looks clunky and it is pretty slow, it does each job requested very very well indeed. Where there's an option to do a short and rough cut, it does not take it.

    So to resize an image called in.png to out.jpg you can call

    convert in.png -resize 800x600 out.jpg

    and it will do it but if the aspect of the image was not 4:3 then it maintains the aspect of the original. If you definitely want it that size then call

    convert in.png -resize 800x600! out.jpg

    If the image was larger than 800x600 then it down samples it using a lanczos filter and if going up it uses the Mitchell filter. To put that simply, it uses very good algorithms in both directions. It uses pretty good defaults for just about everything in fact.

    To go into detail about a lot of what it can do would take many many pages and there's oodles of spec and tutorial stuff for it out there. My seamless tiling script is windows batch file calling IM commands to do it so you can have a look at that to see it doing more complicated stuff.

    My advice tho is go to the usage pages and see the zillion examples to do all the fancy stuff it can do if you know how. I have to look up loads and loads of stuff its too much to remember.

    http://www.imagemagick.org/Usage/

  4. #14

    Post

    So one quick usage question. I scanned the documentation you linked to, and based on that, this should work.

    If I use the command
    convert in.jpg -resize 10000x200 out.jpg

    I should get an image that is 200 pixels high, and the width will remain elastic. Is that correct? Is that the best way to accomplish it, or is there a wildcard of some sort to get IM to ignore one dimension?
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  5. #15
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Post

    Yeah I believe that is the case. I think Y is more important than X. If you did a

    -resize 10000x

    then it would do 10000 wide and scale the height to match aspect. So I think yours is equiv to

    -resize x200

    I believe too that if you use the mogrify command, which is exactly the same as convert but it works on the image supplied not save to a different one, then you can scale all the images in a directory with a wildcard so that they are all 200 high like this

    mogrify -resize x200 *.jpg

    at least your supposed to be able to. I tried that on some test images and its crashing because of the wildcard in it. Hmm not sure but its supposed to work. You should be able to convert all images from jpg to png in a similar manner too...

    mogrify -format jpg *.png

    Anyway, you get the idea, its pretty easy to do batch processing of lots of images at once this way. I know other tools can do this too but I don't think its so easy or so controllable as IM.

  6. #16

    Post

    Somebody hit Redrobes with a rep hammer for me!

    Thanks a lot for the help. Having a decent batch processing tool will make a few things far easier for me; some of them might even relate to mapping. I installed IM months ago, but I've never gotten around to using it for anything other than your seamless tile script.
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  7. #17
    Community Leader Korash's Avatar
    Join Date
    Nov 2008
    Location
    Montreal, Canada
    Posts
    1,601

    Post

    Quote Originally Posted by Midgardsormr View Post
    Somebody hit Redrobes with a rep hammer for me!
    Okay, Done
    Art Critic = Someone with the Eye of an Artist, Words of a Bard, and the Talent of a Rock.

    Please take my critiques as someone who Wishes he had the Talent

  8. #18

    Post

    Quote Originally Posted by Redrobes View Post
    A chap who is using my app has discovered that to make tokens you need to make transparent images and is worried that he will spend half a lifetime drawing alpha transparency masks for all the images he wants to use. He is making a sci-fi world so I thought id use some non copyright NASA images to show what can be done and why its not going to take as long as one might initially think if you know a few tricks.
    Just a note from the chap who 'instigated' this tutorial.

    Thanks for the interesting and informative tutorial, Redrobes, I didn't know any of that and I might be able to apply it one day. (I'll figure out this repping business shortly).

    Unfortunately, this brings me back to the very reason I chose Viewingdale in the first place - these drawing programs are so difficult to learn in a short space of time. They all seem to be made by professionals for professionals.

    You all use these things with such instinctive skill, but here's how it looks through the eyes of a beginner:

    Firstly, you need to learn the controls of the software; then you need to know what an alpha channel is, what it is used for and how to access it and work with it with this particular software; then you need to know what anti-aliasing is, how it affects your image and how this particular software controls it; then you need to know what match colour tolerance is, how it affects your image and how this particular software controls it; then you need to know that expanding the image by a few pixels is a good idea and you need to know how to make the machine do it; then you need to recognise that increasing the brightness and contrast will help you to paint the thing white and you need to know where the controls are to do that; then you need to know that something called soften exists, you need to know what it does and how it will improve your image, then you need to figure how to make the machine do that - and that's just for the 'simple' image in your first example, and it assumes you can even find an 'edge' to draw around amongst the drop shadow.

    Add to that the fact that I don't even know what it is that I need to know, and that the instructions for each operation are buried in a manual the size of an encyclopaedia that I have to read cover to cover to pick out which bits might be relevant...

    All that just to import an image I can stamp down on a map!

    If you only have a couple of hours a week to map in (say it's a back-burner activity for a GM and you want to spend most of that time making maps for next week's game) it can be easier just to find a simple paint program with an eraser that can be set to black, white, or 'transparent' and sit clicking pixels for a few days - at least you can pick that up and put it down in a tea break.
    Mapping a Traveller ATU.

    See my (fantasy-based) apprenticeship blog at:

    http://www.viewing.ltd.uk/cgi-bin/vi...forums&sx=1024

    Look for Chit Chat, Sandmann's blog. Enjoy.

  9. #19

    Post

    Bear in mind that Redrobes is a geek of the highest order: the type who builds his own tools from scratch.

    I've got a little bit of the technician in me, which is why I asked the questions I did, but for most purposes, I'm more of an artist. Most of the time, I want to find a tool that does what I tell it to do with a minimum of fuss.

    I'll try to find some time to write up a supplementary tutorial to do what you seem to need at the moment: make building stamps quickly and easily. For now, I need to do some detailing on my Perspective homework, which is due in two hours:
    Attached Images Attached Images
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  10. #20
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Post

    Yes all very valid points there. I think I am the worst at explaining stuff in simple terms.

    Heres a simple example. I have a cyberman I took with my digi cam and have it on some black paper. I have made three transparency images. First is just the cyberman outline, second is same but has dark grey oval in middle and 3rd is where I have blurred the white version a lot and then added the white back in again. This last one gives a halo effect around him. Putting all three into the app next to each other shows what your going to see. Where the dark grey circle is shows some of the black paper but allows a lot of the floor pattern through too. Basically you can do semi-transparent icons this way.

    I'll see if I can add the VMI file's as a zip at the end. You would need to create icons for those images to get a cyberman in your scene. I posted that cyberman as a PNG file in my challenge entry Dec08 for those Gimp/PS/PNG based users.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •