Automator or Applescript using png files with alpha channel

I have hundred of png files with alpha channel.
I want to suppress alpha channel.
How can i do it using Automator or Applescript ?
Thank you very much.

You can use the free command line image processing tool ImageMagick in your Applescripts or Automator workflows, as well as from a Terminal shell.
You can download ImageMagick from http://www.imagemagick.org, but Cactuslab has simplified installation by putting together an installer package. It’s available at  http://cactuslab.com/imagemagick/. Download the package and double-click on it. Follow the instructions to install. It will install ImageMagick into /opt/ImageMagick and add it to your $PATH by creating a file in /etc/paths.d/. Restart your computer for the changes to take effect.
The two ImageMagick commands we’re concerned with are “convert” and “mogrify”. Convert is more efficient for multiple and piped operations on the same image file, and mogrify is more efficient for batch processing. Generally speaking, convert will output a file separate from the input file. Unless a path is specified, mogrify will overwrite the input file with the output file. An important distinction.
You can perform various operations on the alpha channel using arguments after either the convert or mogrify command. Two of the available arguments are:
-alpha off - Disables the image's transparency channel. Does not delete or change the existing data, just turns off the use of that data.
-alpha remove - Composite the image over the background color.
Also of use are the -flatten and -background options:
-flatten - overlay all the image layers into a final image and may be used to underlay an opaque color to remove transparency from an image.
-background - sets the background color.
Start off using the convert command with a single image to see the effect and adjust to your liking. Once you’ve achieved the desired outcome, then use the mogrify command to batch process the chosen images.
Before getting into how to use Automator or Applescript in your workflow, use Terminal and the command line to see the effect on a single image. Copy one image to your ~/Desktop. In Terminal change the directory to ~/Desktop by typing the following command and pressing the Enter key:
cd ~/Desktop
Then choose the option you are looking for, -alpha remove for instance, type the following command and press the Enter key:
convert input-photo.png -alpha remove output-photo.png
You can check the alpha channel (transparency) and background in the Preview app, go View > Show Image Background from the menu bar.
Once you’re ready to batch proces, place all the photos you want to convert with the same command into one folder. Copy the folder to your ~/Desktop. Let’s assume you’ve labeled the folder “InPhotos”. It’s prudent to manipulate copies in case something goes amiss. In that event you can copy the folder with the originals again and start over. Create a new empty folder on your ~/Desktop and call it “OutPhotos”. Let’s also assume your home directory is called “Me”. The following command will process the photos from the InPhotos folder and put them in the OutPhotos folder:
mogrify -alpha remove -path /Users/me/Desktop/OutPhotos/ /Users/me/Desktop/InPhotos/*png
According to Apple Technical Note TN2065:
"when you use just a command name instead of a complete path, the shell uses a list of directories (known as your PATH) to try and find the complete path to the command. For security and portability reasons, do shell script ignores the configuration files that an interactive shell would read"
So, you need to use the full path to to ImageMagick commands, unlike in the shell where you can just use the command name.
To batch process using Automator, use the “Run Shell Script” action (note: retain the single space at the beginning of the last line):
/opt/ImageMagick/bin/mogrify \
-alpha remove \
-path /Users/Me/Desktop/OutPhotos/ \
/Users/Me/Desktop/InPhotos/*png
To batch process using Script Editor (Applescript), use the “do shell script” command:
do shell script "/opt/ImageMagick/bin/mogrify -alpha remove -path /Users/pd/Desktop/OutPhotos/ /Users/pd/Desktop/InPhotos/*png"
Further info on ImageMagick:
http://www.imagemagick.org/script/command-line-options.php#alpha
http://www.imagemagick.org/Usage/masking/#remove
http://www.imagemagick.org/index.php
http://www.imagemagick.org/script/command-line-tools.php
http://www.imagemagick.org/script/command-line-options.php
Examples:
The original PNG image:
-alpha off:
-alpha remove:
-background black -flatten:
-background blue -flatten:
-channel alpha -evaluate Divide 2:
-channel alpha -evaluate Divide 2 -background black -flatten:

Similar Messages

  • Flash Player for FLV files with alpha channel encoded

    My goal is to play the the transparent background flash video on the bottom right hand corner similar to the video on this website : http://www.dropshipblueprint.com/
    I already have the FLV file with alpha channel encoded.  I was made to understand I will need a special flash player that can read alpha channel in the flv file to make the background transparent? Is this correct? If yes, then how to accomplish this or where do I get that player, maybe opensourece player?  If the player is not a solution then how do I accomplish my end objective taking into consideration I have the FLV file with the alpha channel encoded.  Thanks for your help. Sam

    Sam,
    Welcome to the forum.
    Where do you need to play this "sprite" (the name for such a Flash video)?
    If you need to add that to a Video, then there could be a few challenges in PrE.
    If you need to add it to a Web site, then Flash Player (free from Adobe) should be able to display that.
    Can you please give us just a bit more info, on how you wish to use the sprite?
    Good luck,
    Hunt

  • Layered Photoshop files with alpha channels

    I wondered if anyone had a work around for the problem of layered PSD files with alpha channels not previewing properly in Aperture 3.1.1. I know it's been an issue in previous versions of Aperture but I thought Apple would have sorted this by now, or am I asking too much?

    I tested a file last night as follows:
    Sent file via 'Edit with Photoshop CS5' (as PSD 8-bit, sRGB color space) > changed background to normal layer > created circular selection around subject and inverted to remove most of image leaving transparent area (about 70% of image) > saved file > closed Photoshop > file updated in Aperture with black filling in the transparent area.
    Resent the PSD back to Photoshop (which opened correctly with transparent area) > created two new layers and sent one to background > filled new background layer with White and left top new layer transparent > saved again and closed Photoshop > file updated in Aperture with white showing in transparent areas (no black).
    AFAIK, this is how it is designed to work.
    My only other suggestion would be for you to create a new empty library (press Option while launching Aperture > Create New..) and then import one RAW or JPEG file and test.
    Note - you can reset Photoshop by holding down 'Command + Option + Shift' immediately after launching Photoshop and clicking 'Yes', then set the 'Maximize Compatibility...' to 'Always' again. Doing this prior to sending the file from new library would probably be best.
    Apologies in advance if you have already tried this and for outlining procedures that you are already familiar with (just not sure what level Photoshop user you are).

  • Sudden problem with importing tiff files with alpha channel (CS5)

    OK this is driving me nuts. For years I have been importing image files that have an alpha channel  into FCP as.tiff files. I use Photoshop files only when I want to use the layers as they are too cumbersome otherwise). I have recent upgraded Photoshop, etc. to CS5 and now FCP won't import them anymore. I get a message saying: "File error: 1 file(s) recognized, 0 access denied, 1 unknown"
    I am not doing anything different and tiff files created in just the same way in an earlier version of Photoshop import and work just fine. Is this a CS5 bug? Does anyone know of a work around. I want to keep using tiff files as they seem to work best for me with alpha channel work (and I don't see why I need to reinvent the wheel).
    Thanks
    A

    I've had a similar issue recently. Same TIFF files downloaded from the same server, different FCP project, new error. I either see"File error: 1 file(s) recognized, 0 access denied, 1 unknown" or I get the even stranger, "Unrecognized file type."
    I can open them in PS and save them again as TIF, same results. I know these are not CMYK files but even if resave the TIF as RGB, I get the same results, they are not recognized by FCP.
    But if I open them in PS and save them as PNG with alpha, they improt fine.
    I have no idea what's going on.
    bogiesan
    Message was edited by: David Bogie Chq-1

  • Graphics, ImageIO, and 32-bit PNG images with alpha-channels

    I have a series of 32-bit PNG images, all with alpha channels. I'm using ImageIO.read(File) : BufferedImage to read the PNG image into memory.
    When I call graphics.drawImage( image, 0, 0, null ); I see the image drawn, however all semi-transparent pixels have a black background, only 100% transparent pixels in the source image are transparent in the drawn image.
    The Graphics2D instance I'm drawing to is obtained from a BufferStrategy instance (I'm painting onto an AWT Canvas).
    Here's my code:
    Loading the image:
    public static BufferedImage getEntityImage(String nom, String state) {
              if( _entityImages.containsKey(nom) ) return _entityImages.get( nom );
              String path = "Entities\\" + nom + "_" + state + ".png";
              try {
                   BufferedImage image = read( path );
                   if( image != null ) _entityImages.put( nom, image );
                   return image;
              } catch(IOException iex) {
                   iex.printStackTrace();
                   return null;
         private static BufferedImage read(String fileName) throws IOException {
              fileName = Program.contentPath + fileName;
              File file = new File( fileName );
              if( !file.exists() ) return null;
              return ImageIO.read( new File( fileName ) );
         }Using the image:
    Graphics2D g = (Graphics2D)_bs.getDrawGraphics();
    g.setRenderingHint( RenderingHints.KEY_ANTIALIASING , RenderingHints.VALUE_ANTIALIAS_ON);
    public @Override void render(RenderContext r) {
              Point p = r.v.translateWorldPointToViewportPoint( getLoc() );
              int rad = getRadius();
              int x = (int) p.x - (rad / 2);
              int y = (int) p.y - (rad / 2);
              BufferedImage image = Images.getEntityImage( getCls(), "F" );
              r.g.drawImage( image, x, y, null );
         }

    You may want to check on you system and see what ImageReaders are available, it could be ImageIO is just not picking the best one, if not, then you can use getImageReaders to get an iterator of image readers, then choose the more appropriate one.

  • Mov files with Alpha channel

    I do alot of video with transparent (Alpha Channel) backgrounds.  I have always converted my avi files to flv files for the web without any issue.  Now I am being asked to put my video onto iPads, iPhones etc.  They won't accept flv files & I read that I can use QuickTime mov files to create an alpha channel.  I have tried several ways to install a mov file (with Alpha) using dreamweaver onto an existing webpage but it always ads a black background with the video.  I have tried the  wmode - transparent option but doesn't do anything.  I know the mov file I am using does have the alpha channel attached because I can bring it back into my rendering program and see it fine. 
    Any help is greatly appreciated.

    What is up!
    Based on my tests, it appears that the Mavericks embedded QT structure no longer considers many of the legacy compression formats to be supported under Mavericks. These formats were, by default, turned off under Lion and Mountain Lion which may indicate that Apple intends to drop even passive native support sometime in the future. Files containing Animation or PNG compressed data are no longer QL compatible and now force automatic QT X v10.3 conversion as mentioned above. Even worse, it appears other commonly used fomats like DV/DV in DV and AIC/PCM in MOV are also being relegated to this group. Luckily, DV/PCM in MOV, HDV/PCM in MOV, and ProRes422/PCM in MOV, along with all of my H.264/AAC/AC3/Chapter M4V distribution/iTunes managed files remain fully compatible with both QL and QT X v10.3 under Maverisks. This last is significant for me since many files containing AC3 as the primary audio stream are no longer QL/QT X v10.3 compatible with certain file extensions and/or container types which now appear to be checked in specific situations. Unfortunatly, what we've seen and learned thus far seems to be just the "tip of the iceberge."

  • Why can't I see the Finder thumbnails for .mov files with alpha channels?

    Ever since I upgraded to Mavericks I haven't been able to see the thumbnail for or preview using spacebar any .MOV clips that contain alpha channels in Finder. PSDs and PNGs with alpha channels are fine, and I can still see their thumbnails and previews, it's just .MOV clips with alpha. Here are a couple screenshots:
    Most of these clips are using a PNG codec, but I converted on to the Animation codec and tested it in After Effects to make sure it kept the alpha channel and it did, but the same thumbnail error persists.
    Any idea why this might be or how to fix it?
    27" iMac late 2012
    1TB Fusion
    NVIDIA GeForce GTX 680MX 2048 MB
    16GB RAM
    OS X Mavericks
    Thanks.

    ok, have copied the photos again from the memory card and hey presto, it all works fine.  So in summary...for RW2 files from GF1 camera, I have no thumbnail images, couldn't view in Preview, and neither Quickview nor Coverview were working.  Ran the bit of code provided at "https://discussions.apple.com/message/18369759#18369759" (thanks to Snoop Dogg) and then recopied the photos onto my Mac (only required for photos copied since upgrading to Lion, everything from before the upgrade is fine anyway).
    Hope others find this helpful.

  • Can no longer import QT files with alpha channel

    I have been using these client supplied QT with alpha channel files just fine for weeks, then all of a sudden, after a crash the other day, I was unable to open sequences with these files and exoprt them, the exporter would just freeze.  the clips played in the timeline, but VERY sluggish.
    On the reccomendation of a few posts around here, I removed the clips from the project, and now I cannot import them back in, I get a "the importer reported a generic error" message.  I am able to open in QT pro and export to a new file that will import to PPro, but I lose the alpha channel.
    As always, I'm up against a deadline and any help would be greatly appreciated.
    I have installed QT 7.07, no help.
    I'm on a windows 7 machine running CS master collection 5.0, Quad core AMD with 8 gig RAM.
    These files worked fine just days ago!!!!
    BTW, I just switched over to Premiere a few months ago and to honest I can't understand how anyone would stick with this buggy software, as a professional I've never used anything this bad before.

    Welcome to the forum.
    Try these.  Attempt to re-import after each one:
    Clean the media cache database via Edit | Preferences | Media
    If step 2 doesn't work, then find all the .qtindex, .mpgindex, .cfa and .pek files associated with the media that's supposed to be in your project and delete them.  Then clean the media cache database again.
    Launch Pr and while it's launching, hold down the Alt + Shift keys until the Welcome screen appears.  Alt resets your preferences and Shift resets the plug-in cache.
    To address the other issues you say you've been having with Pr, you should start a different thread (or threads).  Coming from other editors, there may be a difference in the way Pr does things that produce unexpected results that may be seen as bugs.  More serious issues, such as crashes, can often be caused by 3rd-party hardware like AJA, Matrox or BlackMagic and the associated drivers.  Outdated or incorrect drivers for audio and video cards can also cause problems.  I recommend that you start troubleshooting those areas first.
    Other issues may have workarounds.  If you have serious, reproducible problems that have no workaround, then please file bug reports here:
    Adobe - Feature Request/Bug Report Form
    -Jeff

  • Export PNG images with alpha channel from flash

    Hi,
    I have this FLA with animation and when played, the animation has alpha channel. I can’t understand why when I look in the library I see the frames without the alpha channel and also when I try to export/extract the image again the image don’t have alpha channel.
    How is it that in flash this image has alpha channel and how to get it out like that into PNG?
    Here is the link to download the FLA:
    http://download759.mediafire.com/nb749r29220g/e0636ab0ru6ouoa/Untitled-1.fla

    "when played, the animation has alpha channel"
    how are you playing the animation? control/enter in Flash, Publishing to a Web page or what?
    How can you tell that the animation has the alpha channel? What exactly are you seeing?
    What is the aniimation? a series of images, one image moving? Are teweens imvolved?
    " when I try to export/extract the image again the image don’t have alpha channel"
    How are you exporting the image? is it a single image? or a series of frames that makes up an animation?
    What was the file format of the original image? you brought that image into Flash and animated it? Now you want to export as a .png with transparency?
    Have you ever tried to export a  simple .png before so that you see and understand the dialog box that pops up during export? are you chosing "24 bit with alpha channel" in the "Colors" choice?
    For those of us who may not want to download your file, please provide a more detailed describtion of everything related to this question.
    Best wishes,
    Adninjastrator

  • Using PNG files with transparent background - Please Help

    I just purchased Elements to do a very specific task which I can’t do in Aperture. I am a former photoshopper (V.5) and excited to be back.
    I am doing a book/scrapbook and the majority of my text will be my own handwriting. I use white paper and black ink and I scan in at the highest settings. My goal is to create my handwriting on a transparent background so I can place it in my book as I choose. For this specific project (which is very large in scope) I wanted to keep my image/file management within Aperture.
    So I import my file (of my handwriting) from Aperture and successfully saved with a transparent background. Adobe said I had to save it as a PNG file. I noticed when I saved in Photoshop there was a warning saying I had to save as a copy.
    Aperture does not see the file when I try to import it back. My interchange between aperture and photoshop is fine otherwise. This problem only seems to be with “unflattened” layered images. When I flatten the image it is recognized by Aperture, but I lose the transparent background in Photoshop.
    If anyone sees flaws here or has a suggestion to “isolate” and save my personal handwriting image files I would greatly appreciate it. Thanks!

    Would probably work best if you first export from Aperture as PSD (if possible, like Lightroom) and then save to preserve layers.
    From the PSD save as PNG24 rather than PNG8 which is better for preserving transparency.

  • .mov files with alpha channels won't import on Adobe Premiere Pro CC

    Just FYI, Apple:
    This issue with Quicktime not seeing .mov files in Finder (or I should say, not playing them) is a HUGE problem for anyone who edits video.
    If you export a file as .mov in After Effects, and have any transparency (RGB+Alpha channels), there is no way to import them into current projects. None.
    PLEASE fix this, as I quite enjoy my job, and don't feel like losing it because my client doesn't understand why they can't have lower thirds in their video I'm contracted to do (and subsequently fires me and finds someone on a Windows rig).
    Thanks.

    What is up!
    Based on my tests, it appears that the Mavericks embedded QT structure no longer considers many of the legacy compression formats to be supported under Mavericks. These formats were, by default, turned off under Lion and Mountain Lion which may indicate that Apple intends to drop even passive native support sometime in the future. Files containing Animation or PNG compressed data are no longer QL compatible and now force automatic QT X v10.3 conversion as mentioned above. Even worse, it appears other commonly used fomats like DV/DV in DV and AIC/PCM in MOV are also being relegated to this group. Luckily, DV/PCM in MOV, HDV/PCM in MOV, and ProRes422/PCM in MOV, along with all of my H.264/AAC/AC3/Chapter M4V distribution/iTunes managed files remain fully compatible with both QL and QT X v10.3 under Maverisks. This last is significant for me since many files containing AC3 as the primary audio stream are no longer QL/QT X v10.3 compatible with certain file extensions and/or container types which now appear to be checked in specific situations. Unfortunatly, what we've seen and learned thus far seems to be just the "tip of the iceberge."

  • A movie file with Alpha channel works in Color??

    I have files exported from Motion which contain Alpha channel.
    What I like to do is to correct color of the files in Color 1.5.
    When I import them into a sequence with two tracks in FCP, it appears correctly with the alpha channel.
    But once I send it to Color, the files in the top layer (V2) doesn't show the bottom layer (V1).
    It means the transparent parts will be all black.
    I know ProRes 4444 supports alpha channel and I think the files are ProRes 4444 since they work correctly in Motion and FCP.
    I read all the related threads here but no luck so far...I'd appreciate your help!

    Shake. OR... Apple "SHAME".
    http://en.wikipedia.org/wiki/Shake_(software)
    You might still be able to find it in University bookstores seriously marked down. It is a fantastic product. However, Apple seems to feel that its VFX market is best served by pillaging the Shake code and reinserting a dumbed-down version into FCP and Motion. They are wrong.
    The app is still very much in use, very much appreciated.. very recently for completion of "District 9" -- http://www.fxguide.com/fxpodcast.html
    You can do things like pull in your graded ProRes plus the original with alpha and copy the 4th channel into a new QT, so that the new version does what the codec should be doing.
    jPo
    jPo

  • Tiff files with Alpha Channels do not display or print correctly...

    I have Tiff files that have been edited in Photoshop that do not display correctly. As far as I can tell this is caused by the existence of Alpha channels in the channels panel in PS. When the files are imported to Aperture, they only display information from either the alpha channel or a layer using that alpha channel as a mask.
    If this is true, what are people doing about it. This cant be acceptable???
    Are there any work arounds and is apple addressing this problem?
    Can anyone else confirm this?
    I am using Aperture 1.1.2, OS 10.4.7 and PS CS. on a Dual 2GHz Power PC G5 with 4.5 GB RAM
    Please note, these are NOT .psd files. I have read and am aware of some psd compatibility issues, and have checked the maximize compatibility in PS.
    -Sol

    Thank you for your response, I am trying to figure out what to do differently when we re-create the PDF so we don't have font issues when we combine. I don't want to keep recreating the problem, I am looking for a solution. Why does this happen? What settings do I tell other to apply on their Acrobat? Is the a font issue in Adobe? I found this on a Google search on the internet and can't seem to get it to work on XI PRO.
      Embedding fonts into Acrobat 9 through Distiller:
    Launch Acrobat.
    Choose Advanced > Print Production > Acrobat Distiller.
    Select Standard in Default settings.
    Go to Settings and select Edit Adobe PDF Settings.
    Select Fonts and in the font source window select the fonts you want to Add.
    Click Save As and then OK.

  • Adding logo with Alpha channel to Quicktime and exporting as .mp4

    I'm adding a PNG file with alpha channel to my existing movie file using "Add to Selection and Scale".
    I then have my movie with the overlayed graphic.
    When I then Export as an mp4, the alpha channel is ignored!
    Any help, anyone?

    Yes it looks perfect in Quicktime.
    But for some reason I can't save it as anything else or even export a still frame without the alpha being ignored and the image going all fuzzy.

  • What codec to convert .MXF and MP4 files into to use with alpha channels in Ae and Pr CS6?

    When I import .mxf File, shot on a Canon C300, into after effects, the alpha channel options are greyed out, when I look in, interpret footage, main. This also is the case importing .MP4 files, shot on a Gopro hero 3. I used to use final cut and using compressor convert the files to pro res 4444 or 422. What's my new workflow for preparing files with alpha channels to use in After Effect and Premiere and do I use Media Encoder to do it?

    When I import .mxf File, shot on a Canon C300, into after effects, the alpha channel options are greyed out, when I look in, interpret footage, main. This also is the case importing .MP4 files, shot on a Gopro hero 3.
    Better question: Where do you expect that Alpha channel to come from and contain any useful info for transparency? You're making a fuss over a non-issue. Unless you apply keying or other methods of creating transparency, even if there were an Alpha channel it would be fully opaque and then what's the point?
    Mylenium

Maybe you are looking for