Sort image files by average luminance and by average hue?

Hi.  I would like to be able to sort images by average luminance and by average hue.  Is there anything in OS X that will let me determine the average luminance or average hue of an image, and save that datum to the image?
Ultimately, I would like to use this within Aperture (my sole area of expertise {all my ASC points are from the Aperture forum}).  After I posted the question there, a regular suggested I post in this forum to find out what is possible:  specifically, are there any AppleScript hooks that might allow this?  (Sadly, I don't script, but it helps me know what can be done.)
I know of one program which does this: CF/X's Photo Mosaic, which uses the averages to match an image to a tile in the "master image".  I don't know of any way to attach the Photo-Mosaic-generated averages to the files themselves.  I asked CF/X about this today.
Thanks.

Hello
You may try the AppleScript script listed below. It is a simple wrapper of rubycocoa script which uses CIFilter to calculate average brightness and hue of each image (jpg|jpeg|png) in specified directory tree. It is a skeleton just to generate a TSV output of [brightness, hue, file] records sorted by brightness and then hue on desktop. I don't know how to embed these info into image metabata.
Script is briefly tested under 10.6.8.
Hope this may help somehow,
H
PS. If copied code has extra spaces in front of every line, which appears to be the case with some browsers including Firefox, please remove them before running the script.
-- SCRIPT
set d to (choose folder with prompt "Choose start folder")
set args to d's POSIX path's quoted form
do shell script "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w <<'EOF' - " & args & " > ~/desktop/test_out.txt
#     get average brightness and hue of image files (jpg|jpeg|png)
#     * output record = B=brightness [TAB] H=hue [TAB] file [LF]
#     * sorted by brightness and then hue
require 'osx/cocoa'
include OSX
EXTS = %w[ jpg jpeg png ]    # target extensions
module OSX
    class << CIContext
        def contextWithSize(w, h)
            br = NSBitmapImageRep.alloc.objc_send(
                :initWithBitmapDataPlanes, nil,
                :pixelsWide, w,
                :pixelsHigh, h,
                :bitsPerSample, 8,
                :samplesPerPixel, 4,
                :hasAlpha, true,
                :isPlanar, false,
                :colorSpaceName, NSCalibratedRGBColorSpace,
                :bytesPerRow, 0,
                :bitsPerPixel, 0)
            c = NSGraphicsContext.graphicsContextWithBitmapImageRep(br)
            CIContext.objc_send(:contextWithCGContext, c.graphicsPort , :options, {})
        end
    end
    class CIFilter
        def setParameters(dict)
            self.setValuesForKeysWithDictionary(dict)
        end
        def output
            self.valueForKey('outputImage')
        end
    end
    class << CIVector
        def vectorWithRect(r)
            self.vectorWithX_Y_Z_W(r.origin.x, r.origin.y, r.size.width, r.size.height)
        end
    end
end
# process ARGV and retrieve image files with given extensions under specfied directory
raise ArgumentError, %Q[Usage: #{File.basename($0)} directory] unless ARGV.length == 1
dir, = ARGV.map { |a| a == '/' ? a : a.chomp('/')}
ff = %x[find -E \"#{dir}\" -type f -iregex '.*/.*\\.(#{EXTS.join('|')})$' -print0].split(/\\0/)
# get CIContext and CIFilter
cic = CIContext.contextWithSize(5000, 5000)  # let it be large enough
cif = CIFilter.filterWithName('CIAreaAverage')
cif.setDefaults
# retrieve average brightness and hue of images
hh = {}
ff.each do |f|
    u = NSURL.fileURLWithPath(f)
    ci = CIImage.imageWithContentsOfURL(u)
    civ = CIVector.vectorWithRect(ci.extent)
    cif.setParameters({'inputImage' => ci, 'inputExtent' => civ})
    ciout = cif.output
    cgout = cic.objc_send(:createCGImage, ciout, :fromRect, ciout.extent)
    colr = NSBitmapImageRep.alloc.initWithCGImage(cgout).colorAtX_y(0, 0)
    hh[f] = { :b => colr.brightnessComponent, :h => colr.hueComponent}
end
# sort criteria
brightness          = lambda { |k| hh[k][:b] }
hue                 = lambda { |k| hh[k][:h] }
brightness_and_hue  = lambda { |k| b, h = hh[k].values_at(:b, :h); b * 1e6 + h }
# print sorted records
hh.keys.sort_by(&brightness_and_hue).each do |k|
    b, h = hh[k].values_at(:b, :h)
    puts %Q[B=%f\\tH=%f\\t%s] %  [b, h, k]
end
EOF"
-- END OF SCRIPT

Similar Messages

  • Is there a way to save an image file as a jpeg and add -web or -print to the file name?

    I am trying to find a way to save my image file as a jpeg and add -web or -print to the existing file name.  This way I can easily see which files are lower resolution for web posting or high resolution for printing.

    Jason,
    I helped somebody do a very similar thing about a week ago.
    The trick is to use the Batch command's ability to construct a file name.
    Tell the batch to append, e.g. "-x" without quotes, to the name of each saved file.
    The batch runs an Action which does a save as JPEG, resize image, add logo, save as JPEG, then close document.
    The output is "<document name>-x.jpg" and "<document name>-x-x.jpeg".
    Then use Windows Explorer to rename "*-x-x.jpg" to "*-print.jpg".
    Then rename "*-x.jpg" to "*-web.jpg".
    See http://forums.adobe.com/thread/1038992?start=32
    The name construction that I used there was just an "x" appended to the document name. Use whatever you like. Also juliew subsequently referred to the method as a "double-batch" run, although it is not. One run of the batch will output two JPEGs for each input document.
    I hope the disagreements in that thread don't cause too much disruption.
    If you want, the Batch command itself can be recorded in another Action which would store the parameters of the batch, then you could run that Action anytime without having to set up the details of the batch each time. It would always output to one specific folder, though.

  • Aperture import plug-in won't run.  After examining my library the number of image files stays at "undetermined" and the import button stays greyed out.  Any thoughts?

    Aperture import plug-in won't run.  After examining my library the number of image files stays at "undetermined" and the import button stays greyed out.  Any thoughts?

    Others have the same issue, with the import button being grayed out.  My trail copy expired, but I believe by poking around in the options and selecting another Aperture library and re-selecting, I was able to continue.
    The problem is common enough, that hopefully Adobe will address.  In the mean time, try repairing your Aperture library, checking permissions, exporting a subset of your library for a test, or try putting that library subset on an external drive.  (Can usually avoid permissions issues.)

  • How use PHP to read image files from a folder and display them in Flex 3 tilelist.

    Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
    PHP :
    PHP Code:
    <?php
    //Open images directory
    $imglist = '';
    $dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "filename: " . $file . "\n";
    $dir->close();
    ?>
    FLEX 3 :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.rpc.events.ResultEvent;
    public var image:Object;
    private function resultHandler(event:ResultEvent):void
    image = (event.result);
    ta1.text = String(event.result);
    private function faultHandler(event:FaultEvent):void
    ta1.text = "Fault Response from HTTPService call:\n ";
    ]]>
    </mx:Script>
    <mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
    <mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
    <mx:HTTPService id="pic" url="{phpPicture}" method="POST"
    result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
    <mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
    <mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
    </mx:Application>
    Thanks. Need help as soon as possbile. URGENT.

    i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
    PHP Code:
    <?php
    echo '<?xml version="1.0" encoding="utf-8"?>';
    ?>
    <root>
    <images>
    <?php
    //Open images directory
    $dir = dir("images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
    //$dir->close();
    ?>
    </images>
    </root>
    Flex Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="callPHP();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.http.HTTPService;
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var arr:ArrayCollection = new ArrayCollection();
    private function callPHP():void
    var hs:HTTPService = new HTTPService();
    hs.url = 'Picture.php';
    hs.addEventListener( ResultEvent.RESULT, resultHandler );
    hs.addEventListener( FaultEvent.FAULT, faultHandler )
    hs.send();
    private function resultHandler( event:ResultEvent ):void
    arr = event.result.root.images.image as ArrayCollection;
    private function faultHandler( event:FaultEvent ):void
    Alert.show( "Fault Response from HTTPService call:\n " );
    ]]>
    </mx:Script>
    <mx:TileList id="tilelist"
    dataProvider="{arr}">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Image source="images/{data}" />
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

  • Reading only Image Files from a Directory and ignoring the rest

    i am wanting to be able to read a directory but only obtain the Image files (ie, gif, jpeg, tiff, png etc) and ignore all other type of files.
    i have made a custom ImageFIlter class which extends FileFilter which works for adding a photo singly, as only image files are shown in the JFileChooser. however i am wanting to add a folder of photos at once.
    here is the code so far:
    File dir;
                        JFileChooser fc = new JFileChooser();
                        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                        //Handle open button action.
                        int returnVal = fc.showOpenDialog(MainAppGUI.this);
                        if (returnVal == JFileChooser.APPROVE_OPTION) {
                             dir = fc.getSelectedFile();
                             if (dir.isDirectory()) {
                                  File[] files = dir.listFiles(new ImageFilter());
                                  for (int i = 0; i < files.length; i++) {
                                       if (files.isFile()) {
                                            try {
                                                 Photo PhotoAdded = workingCollection.addManyPhotos(files[i], canvas.getChangedMaxDim());
                                                 //need to also add it to the relevant vectors, ie
                                                 //for mouse over operations, or photos added after
                                                 //save.
                                                 if(!workingCollection.isDuplicate()){
                                                      photosToCheck.add(photoAdded);
                                                      canvas.addToGrid(photoAdded);
                                                      photosAddedAfterLoad.add(photoAdded);
                                                      canvas.repaint();
                                                 else{
                                                      //do nothing as it is already in the vectors.
                                            } catch (Exception er) {
                                                 // Do nothing. Bad mp3, don't add.
                                       // recurse through directories
                                       else {
                             } else {
                                  try {
                                       throw new IOException(
                                                 "Error loading files from a directory: "
                                                           + dir.getAbsolutePath() + " is not a "
                                                           + "directory");
                                  } catch (IOException e1) {
                                       // TODO Auto-generated catch block
                                       e1.printStackTrace();
    any ideas?

    I'm confused.
    You already ARE using a FileFilter to only pick up image files. Whats the problem?
    If you need to recurse directories you need to change your code only a little.
    Write your method
    JFileChooser fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    //Handle open button action.
    int returnVal = fc.showOpenDialog(MainAppGUI.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      dir = fc.getSelectedFile();
    if (dir.isDirectory()) {
      scanDirectory(dir);
    else{
      // not a directory
    public void scanDirectoryForPhotos(File directory){
      // taking your code
    if (dir.isDirectory()) {
      File[] files = dir.listFiles(new ImageFilter());
      for (int i = 0; i < files.length; i++) {
        if (files.isFile()) {
    // details deleted
    // recurse through directories
    else {
    scanDirectory(files[i]);
    Your exception handling is a little strange. You throw an exception only to catch it immediately to print a stack trace? Not exactly the most common handling I've seen. You should probably just throw the exception and let the next level down handle it.
    Cheers,
    evnafets

  • Convert image file names to labels and resizing images according to frame. Possible??

    Hi all,
    I have posted this question hastily in the main mac forum but then i realized it is a scripting question so I repost here.
    Q1: I have a client with 700+ images who has named the images with numbers and the caption:
    eg: 1.II.34. Walking down the road towards the building.tiff
    This is the name of the image file itself
    Is there a way to import the name of the file (possibly without the extension) and place it as a caption under the image without copying and pasting? A script maybe?
    I tried the labelgraphics script. Unfortunately it returned the extension as well. I was given a solution but did not work for me since it deleted everything after the first dot on the name. This was:
    in labelgraphics on line 105, change
    myLabel = myLink.name
    to
    myLabel = myLink.name.split('.')[0]
    So how can we tackle this so it deletes everything after the LAST dot?
    Q2: The image files I am given are all huge tiff files. I use the full 100% of the images but in my document they have to be much smaller . They are usually scaled down to 25-35% of the original file. So I end up with huge, unneeded documents.
    Is there a script that would work together with photoshop maybe?
    It would need to read the frames dimensions the image is in, open the linked file inside photoshop, resize it with a specified interpolation to maybe 110% of the frame's dimensions, set the resolution (if not set) to 300 dpi save the image as a copy (or with a suffix or prefix), leave photoshop open (for the next image to be processed), relink to the new image and go to the next image
    I know it sounds a lot but I was amazed by the issues people handle in this forum and thought I would give it a try
    Thank you in advance
    Michael

    Peter thank you so much. It works like a charm.
    As for Q2, I spent some time doing research and came up with a couple of scripts that sound like they could do the trick.
    a) Image Transform or Rasterize
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1509 022#
    b) Resample Project Images to 100%
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1612 518#
    Still, since I am such an ignorant I do not know which one would be the proper one.
    Any suggestions would be highly appreciated.
    Thank you once more
    Michael

  • Since installing Tiger my images files are missing .jpg and won't open.

    Upgraded to Tiger a month or so ago. Now when I open some images files there are two extra items in the folder. One marked FINDER.DAT and another folder marked RESOURCE.FRK in upper case. My images will not open because the .jpg has been removed. I can retype the .jpg and they will open, but we are talking over 4000 images here. What happened? G4 Quicksilver, OS 10.4.10, Photoshop Elements 3, Toast Titanium, Firefox, Seamonkey, Safari, etc.

    Copy this script into Script Editor, compile it, and run it on the .DAT folder:
    Add Prefix/Suffix to files script:
    <begin script>
    tell application "Finder"
    activate
    set the chosen_folder to (choose folder with prompt "Pick the folder containing the files to rename:")
    set the prefixorsuffix to ""
    repeat
    display dialog "Enter the prefix or suffix to use:" default answer the prefixorsuffix buttons {"Cancel", "Prefix", "Suffix"}
    copy the result as list to {the prefixorsuffix, the button_pressed}
    if the prefixorsuffix is not "" then exit repeat
    end repeat
    set the file_list to (every file of the chosen_folder) as list
    repeat with this_file in the file_list
    if the button_pressed is "Prefix" then
    set the newfilename to the (the prefixorsuffix & name of this_file) as string
    else
    set the newfilename to the (name of this_file & the prefixorsuffix) as string
    end if
    my setitem_name(thisfile, the newfilename)
    end repeat
    end tell
    beep 2
    on setitem_name(thisitem, newitemname)
    tell application "Finder"
    activate
    set the parentcontainerpath to (the container of this_item) as text
    if not (exists file (the parentcontainerpath & newitemname)) then
    try
    set the name of this_item to newitemname
    on error the error_message number the error_number
    if the error_number is -59 then
    set the error_message to "This name contains improper characters, such as a colon (:)."
    else --the suggested name is too long
    set the error_message to "The name is more than 31 characters long."
    end if
    beep
    display dialog the error_message default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end try
    else --the name already exists
    beep
    display dialog "This name is already taken, please rename." default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end if
    end tell
    end setitemname
    <end script>

  • How to fetch the image file from oracle database and display it.

    hi... i've inserted the image file into the oracle database... now i want to retreive it and want to display it... can anybody help me... pls

    not a big deal dude... i fetched the image from database and saved it into my local hard disk.. but when tried to open it,ends up with no preview... dont know what d prob is... any idea... i've inserted the image as bytes n trying to fetch it as binary stream.. is that the problem... here im giving my insertion and retireving code.. jus go through it...
    Insertion code:_
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.io.File;
    import java.io.FileInputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class Browse_java
    static Connection con=null;
    public static void main(String args[])
    try{
    System.out.println("(browse.java) just entered in to the class");
    con = new PMS.DbConnection().getConnection();
    System.out.println("(browse.java) connection string is"+con);
    PreparedStatement ps = con.prepareStatement("INSERT INTO img_exp VALUES(?,?)");
    System.out.println("(browse.java) prepare statement object is"+ps);
    File file =new File("E:/vanabojanalu-/DSC02095.JPG");
    FileInputStream fs = new FileInputStream(file);
    System.out.println("lenth of file"+file.length());
    byte blob[]=new byte[(byte)file.length()];
    System.out.println("lenth of file"+blob.length);
    fs.read(blob);
    ps.setString(1,"E:/vanabojanalu-/DSC02095.JPG");
    ps.setBytes(2, blob);
    // ps.setBinaryStream(2, fs,(int)file.length());
    System.out.println("(browse.java)length of picture is"+fs.available());
    int i = ps.executeUpdate();
    System.out.println("image inserted successfully"+i);
    catch(Exception e)
    e.printStackTrace();
    finally
    try {
    con.close();
    } catch (SQLException ex) {
    ex.printStackTrace();
    and Retrieving code is:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.beans.Statement;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jdbc.OracleResultSet;
    * @author Administrator
    public class view_image2 extends HttpServlet {
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("image/jpeg");
    //PrintWriter out = response.getWriter();
    try
    javax.servlet.http.HttpServletResponse res=null;;
    int returnValue = 0;
    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    InputStream in = null;
    OutputStream os = null;
    Blob blob = null;
    //String text;
    //text=request.getParameter("text");
    //Class.forName("com.mysql.jdbc.Driver");
    con=new PMS.DbConnection().getConnection();
    System.out.println("jus entered the class");
    //String query = "SELECT B_IMAGE FROM img_exp where VC_IMG_PATH=?";
    //conn.setAutoCommit(false);
    PreparedStatement pst = con.prepareStatement("select b_image from img_exp where vc_img_path=?");
    System.out.println("before executing the query");
    pst.setString(1,"C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    rs = pst.executeQuery();
    //System.out.println("status of result set is"+rs.next());
    System.out.println("finished writing the query");
    int i=1;
    if(rs.next())
    System.out.println("in rs") ;
    byte[] byte_image=rs.getBytes(1);
    // byte blob_byte[]= new byte[(byte)blob.length()];
    //System.out.println("length of byte is"+blob_byte);
    //String len1 = (Oracle.sql.blob)rs.getString(1);
    //System.out.println("value of string is"+len1);
    //int len = len1.length();
    //byte [] b = new byte[len];
    //in = rs.getBinaryStream(1);
    int index = in.read(byte_image, 0, byte_image.length);
    System.out.println("value of in and index are"+in+" "+index);
    FileOutputStream outImej = new FileOutputStream("C://"+i+".JPG");
    //FileOutputStream fos = new FileOutputStream (imgFileName);
    BufferedOutputStream bos = new BufferedOutputStream (outImej);
    //byte [] byte_array = new byte [blob_byte.length]; //assuming 512k size; you can vary
    //this size depending upon avlBytes
    //int bytes_read = in.read(blob_byte);
    bos.write(index);
    /*while (index != -1)
    outImej.write(blob_byte, 0, index);
    index = in.read(blob_byte, 0, blob_byte.length);
    //System.out.println("==========================");
    //System.out.println(index);
    //System.out.println(outImej);
    //System.out.println("==========================");
    /*ServletOutputStream sout = response.getOutputStream(outImej);
              for(int n = 0; n < blob_byte.length; n++) {
                   sout.write(blob_byte[n]);
              sout.flush();
              sout.close();*/
    outImej.close();
    //i++;
    else
    returnValue = 1;
    catch(Exception e)
    System.out.println("SQLEXCEPTION : " +e);
    finally {
    //out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    * Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    * Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    * Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    }

  • Downloading image files from the server and saving them on local disk

    Hello,
    In an AIR app. i want to download number of image files,i have paths
    in an array.I am looping through the array and using URLLoader.Format
    is BINARY,now on the complete event of one file i dont know how to
    store the file on the disk as exactly which file has dispatched the
    event is not known.Please point out if my approach is incorrect or if
    any other ideas -plz share.

    Try the following:
    var imgURLs:Array = new Array();
    imgURLs[0] = "http://www.adobe.com/ubi/globalnav/include/adobe-lq.png";
    imgURLs[1] = "http://www.adobe.com/images/shared/download_buttons/get_adobe_air.png";
    var urlRequests:Array = new Array();
    var urlLoaders:Array = [];
    for (var i:int = 0; i < imgURLs.length; i++)
        loadURL(i);
    function loadURL(i:int):void
        var urlReq:URLRequest = new URLRequest(imgURLs[i]);
        urlRequests[i] = urlReq;
        var urlLoader:URLLoader = new URLLoader(urlReq);
        urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
        urlLoader.addEventListener(Event.COMPLETE,                
                    function (event:Event):void
                        var path:String = urlReq.url;
                        var urlLoader:URLLoader = event.target as URLLoader;
                        saveFileData(path, urlLoader.data);
    function saveFileData(path:String, data:ByteArray):void
        trace(path, data.bytesAvailable);
        // I'll let you write the code to save the data to a file path, based on the URL.
    You could also create a class that includes the event handler function and includes the code for loading the data. Then create a new instance of that class for each URL.

  • Sort Images by average luminance -- possible?  Hints?

    Another edition of "Not that I know of".  :-)
    Is there any way to sort Images in Aperture by average luminance?
    Is there any way to determine the average luminance and save this to a custom metadata field?
    Bonus: hue?
    NB: using the Preview to determine average luminance or hue is OK by me  .
    Thanks in advance.
    --Kirby.

    Frank Caggiano wrote:
    Looks like with the current tools in Aperture there is no way to do this. You might want to look and see if there is any third party apps  but I'm not hopeful.
    I haven't found anything.  There is the app I mentioned in the similar thread in the OS X Dev forum:  CF/X Photo Mosaic.  It (surprisingly quickly!) creates a database of the images that will be used as tesserae in the making of photo mosaic, and allows the user to sort the image database by average color or average luminance.  I've asked their input.  There is no way to export the database, or — afaict — to use any of the information outside the program itself.
    Here's a screengrab from the manual showing images in the Photo Mosaic database with each image's average hue and average luminance displayed as a sample tile and a hex ordinal.  The luminance scale is 1 to 256 (in hex).  I'm not sure what the hue scale is (I guess it's 16 million).
    Frank Caggiano wrote:
      One of the new systems strengths is reported to be the ability to write extensions for the core image engine more easily then the current state of writing a plugin for Aperture. Perhaps something will get written then.
    We'll see.  I am holding my breath.
    Not .

  • Best way to combine 8-bit and 16-bit image files?

    I produce large photographic art prints by combining my own edited 16-bit RAW photo images with 8-bit stock photo images and 8-bit photoshop artwork. I used to just reduce my 16-bit photos to 8-bit and then edit my composite image as 8-bit, but I ran into banding and other problems in the color gradients I created later in my composite image.
    I want my composite image to be 16-bit to get more accurate colors and better gradients. What is the best way to bring 8-bit image files into my composition and maintain best quality? Is it good to convert 8-bit images to 16-bit in PS before importing? I also heard about bringing 8-bit images in as Smart Objects? Thanks for any help on this.

    *Photonic wrote:
    Thanks Jack and Noel. My workflow usually starts w. a 16-bit RAW image brought into Photoshop as the background layer of the master file. Color space is AdobeRGB. Then 8-bit stock photo and art elements (objects) are brought in by dragging the open 8-bit image up to the master image file tab, and then dropping it back into the image window after the file opens.
    Should I use the "Paste In" command instead? I usually avoid copy/paste since some of my element files are usually over 100MB and that seems to challenge my Mac after a while.
    Could I convert the 8-bit image files prior to import, like Noel suggests (Image>Mode>16bits)?  Thanks.
    There is no need to convert 8bit open documents to 16bit mode Photoshop will convert the copied layers to 16bit bit during the drag copy.  Converting the open document would just increase Photoshop RAM usage every layer pixels bytes used  would double in size.
    If you element files are over 100MB they are most likely layered files.  If all you need is a composite you should avoid using Place for that will needlessly inflate your document size. Instead open the element file create a new layer that is a stamp visible layer (Shift+Alt|Opt+Ctrl|Cmd+E) and drag that layer to you document then close nosave your element file. Copy only copies the targeted layer or there is a Copy Merge that copies the composit merge of all targeted layers. It a bit hard to create an action that would be able to use Copy or Copy Merge. Using the above stamp visible way can be made into an action. You also do not want to drag all the layers to your document if you just need a composit layer.
    You could also automate the element file copy with an action.
    Action Step 1 Insert menu into File>Open this will be an interactive step you must select a file to open. When the action is played.
    Step 2 (Shift+Alt|Opt+Ctrl|Cmd+N) Create a new empty layer This will always work
    Step 3 (Shift+Alt|Opt+Ctrl|Cmd+E) stamp visible layers into the new layer
    Step 4 (Ctrl|Cmd+A) select all
    Step 5 (Ctrl|Cmd+C) Copy
    Step 6 Close current document no save
    Step 7 (Ctrl|Cmd+P) Paste into the document your working on Photoshop will convert to 16bit if the document is 16bit mode and the clipboard content is 8bit.
    When you use Photoshop and do something.  Think to yourself how did Photoshop do what you asked it to do. Thing about what is involved what layers must be used etc. How is the feature/function done.
    Message was edited by: JJMack
    Message was edited by: JJMack

  • Want to Transmit and Receive image file. Help??

    I m implementing OFDM transceiver using NI 5640 cards and data to process is an image file. Both transmitter and receiver are separete. Problem is that at receiver side i m not getting the image while transmitter is working properly according to my approach. Please help me......

    Hi Zaib,
    to convert arrays is pretty basic, maybe you should also attend here!
    1d to 2d: use a "build array" node (or use auto-indexing on the output of a FOR loop)
    2d to 1d: this depends on your goal. you may use "index array" to get a row or column from the 2d array. you can use "reshape array" to do reshaping. you may use auto-indexing on the input of a FOR loop. As said above, this depends on your goals...
    For your vis:
    Sorry, I can't access them from home as I only have LV7.1 available at the moment...
    Message Edited by GerdW on 05-18-2009 07:10 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • DMG Image File Error

    Hi Everyone,
    I need your assistance, please help.
    I've created dmg image files in the past and when I try to mount them , I get an error Warning dialogue box that says, "no mountable file system."
    What does that mean?
    I always double click the image and expect it to mount on my desktop. I've tried to mount it with the File>Mount menu via the Disk Utility, but it doesn't work, no error messages. It just doesn't mount.
    This doesn't occur all the time, but when it does, it's always a file that I urgently need.
    Would someone please explain to me what the above warning message means, and what are the possible reasons why this is happens?
    Are there other ways to mount an image with that type of warning message, maybe with some type of utility of some sort?
    Thanks
    Cheers
    KL
    iMac G5   Mac OS X (10.4.3)  

    The message basically means that the file is corrupted or that Disk Utility has a problem. A bit more information is needed. How did you make those dmg files? Can you mount any obtained from another source, such as any of Apple's downloads, by double-clicking on them? If those won't mount, then either the Disk Utility pref file is fouled up or Disk Utility is.
    For the former, move the com.apple.diskcopy.plist and com.apple.diskutility.plist from ~/Library/Preferences/ onto the desktop, log out and back in, and try double-clicking on the dmg file giving you problems. If that doesn't work, create a new admin user account, log into it, and try again. If it works, then the problem's in the original account. If not, then it's probably system-wide and your best bet is to reinstall the 10.4.3 combo update.

  • Disc image file & CSS encoding?

    I originally exported a project with CSS encoding from DVDSP to a DLT tape for replication. (DDP 2.0 with CSS)
    I then created a disc image file of this project and don't remember if I had checked CSS format. Is there a way to determine this by looking through the Video_TS folder or possibly another way.
    thanks,
    dave

    Dave,
    Disc Images, per se, cannot have CSS applied to them (they're fixed at 2048 bytes per sector). This is so you can write the Image to DVD-Recordables - which is not allowed to have CSS on them, or mount the Disc Image on various machines; again, no CSS allowed in that application.
    For sure, Disc Images do have CSS applied to them, but this is only during DDP 2.0, DDP 2.1, or CMF formatting. Though then, you'll have an unplayable Disc Image in that case, until the replicator applies the unscrambling keys during mastering.
    So, if you left the CSS option on, it would have no affect (setting ignored) if formatting a regular "img" to hard drive or Recordable.
    Take care,
    Trai
    TFDVD Research Labs

  • How can add a images file  to anothere image file

    hi
    Requirement is: i have one image in data base , i is show to user in my application
    know we want add another image file in to a current image file (just append)
    at end .
    i was tried with following code below
    i was read the previous(Old) image content from the data base and placed into c:\\ReArchive\\test_content.tiff
    ResultSet rs2=dbBean.getSQLRows("select binarycontent from ContentVersion where contentindex="+IndexValue+"");
    byte[] bTempData_content=new byte[65536];
    while(rs2.next()){              
    File f = new File("c:\\ReArchive\\test_content.tiff");
    f_content.delete();
    f_content.createNewFile();
    FileOutputStream dest_contentVersion = new FileOutputStream(f_content);
    while(rs2.next()){              
    InputStream is_content=rs2.getBinaryStream("Binarycontent");
    nActualRead_content=is.read(bTempData_content,0,65536);
    while(nActualRead_content>0)
    dest_contentVersion.write(bTempData_content,0,nActualRead_content);
    nActualRead_content=is.read(bTempData_content,0,65536);
    Then i was took New image file from data base and place in to c:\\ReArchive\\test.tiff");
    int nActualRead=0;
    ResultSet rs1=dbBean.getSQLRows("select * from Object_Store where Barcode_ID='"+strBar_Code+"'");
    byte[] bTempData=new byte[65536];
    File f = new File("c:\\ReArchive\\test.tiff");
    f.delete();
    f.createNewFile();
    FileOutputStream dest = new FileOutputStream(f);
    while(rs1.next()){
    InputStream is=rs1.getBinaryStream("Obj_Content");
    nActualRead=is.read(bTempData,0,65536);
    while(nActualRead>0)
    dest.write(bTempData,0,nActualRead);
    nActualRead=is.read(bTempData,0,65536);
    then i tried add two images by converting InputStream to String and i am trying add to images
    but i was failed ,i think i am in not correct way , how can i solve this problem
    thanks advance
    gss

    Don't you think it would be a good idea to tell us how you failed?

Maybe you are looking for

  • Year Prompt selection

    Hi gurus, I have a requirement that if I select year value from prompt then the report data should filter with selected year and next year of the selected year. For Ex: If i select year 2010 then the year values in the report output should be 2010,20

  • Strange behavior of the notifications

    Hi guys. I use an iPhone 5S running iOS 7.0.3 and have a strange behavior of the notifications. Example: I get 3 messages from WhatsApp. The lock-screen shows the preview of all 3 messages. OK so far. But if I unlock my iPhone, a banner shows the lat

  • Remove attribute in xml

    Hi      How to delete/remove the attributes from the xml.

  • Does LVM 2.0 support MSSQL Server Alias?

    Dear All Is it possible to manage a MSSQL Server Alias from within SAP LVM 2.0? Will LVM 2.0 detect any change if the alias is changed using the MSSQL tools? Thank you for your input :-) Kind regards Lucas

  • Blackout and Freeze

    Are my settings wrong or something else? Our Macbook and MacBook Pro both behave strangely every day or two: After being unused for a while the monitor blacks out BUT the white cursor (arrow in my case) is visible on the monitor but frozen in place.