<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/unit/default_image_option_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -38,6 +38,9 @@ module Fleximage
     #   very large in filesize.
     # * +default_image_path+: (String, nil default) If no image is present for this record, the image at this path will be
     #   used instead.  Useful for a placeholder graphic for new content that may not have an image just yet.
+    # * +default_image+: A hash which defines an empty starting image.  This hash look like: &lt;tt&gt;:size =&gt; '123x456',
+    #   :color =&gt; :transparent&lt;/tt&gt;, where &lt;tt&gt;:size&lt;/tt&gt; defines the dimensions of the default image, and &lt;tt&gt;:color&lt;/tt&gt;
+    #   defines the fill.  &lt;tt&gt;:color&lt;/tt&gt; can be a named color as a string ('red'), :transparent, or a Magick::Pixel object.
     # * +preprocess_image+: (Block, no default) Call this class method just like you would call +operate+ in a view.
     #   The image transoformation in the provided block will be run on every uploaded image before its saved as the 
     #   master image.
@@ -51,8 +54,9 @@ module Fleximage
     #       image_storage_format      :png
     #       require_image             true
     #       missing_image_message     'is required'
-    #       invalid_image_message     'was not a readable image'
+    #       invalid_image_message     'was not a readable image'\
     #       default_image_path        'public/images/no_photo_yet.png'
+    #       default_image             nil
     #       output_image_jpg_quality  85
     #       
     #       preprocess_image do |image|
@@ -118,6 +122,9 @@ module Fleximage
         # Set a default image to use when no image has been assigned to this record
         dsl_accessor :default_image_path
         
+        # Set a default image based on a a size and fill
+        dsl_accessor :default_image
+        
         # A block that processes an image before it gets saved as the master image of a record.
         # Can be helpful to resize potentially huge images to something more manageable. Set via
         # the &quot;preprocess_image { |image| ... }&quot; class method.
@@ -444,10 +451,19 @@ module Fleximage
         
         # Load the default image, or raise an expection
         def master_image_not_found
-          # Load the default image
+          # Load the default image from a path
           if self.class.default_image_path
             @output_image = Magick::Image.read(&quot;#{RAILS_ROOT}/#{self.class.default_image_path}&quot;).first
           
+          # Or create a default image
+          elsif self.class.default_image
+            x, y = Fleximage::Operator::Base.size_to_xy(self.class.default_image[:size])
+            color = self.class.default_image[:color]
+            
+            @output_image = Magick::Image.new(x, y) do
+              self.background_color = color if color &amp;&amp; color != :transparent
+            end
+          
           # No default, not master image, so raise exception
           else
             message = &quot;Master image was not found for this record&quot;</diff>
      <filename>lib/fleximage/model.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,17 +52,8 @@ module Fleximage
       # - SUPPORT METHODS
       # ---
       
-      # Converts a size object to an [x,y] array.  Acceptible formats are:
-      # 
-      # * 10
-      # * &quot;10&quot;
-      # * &quot;10x20&quot;
-      # * [10, 20]
-      #
-      # Usage:
-      #
-      #   x, y = size_to_xy(&quot;10x20&quot;)
-      def size_to_xy(size)
+      # Allows access to size conversion globally.  See size_to_xy for a more detailed explanation
+      def self.size_to_xy(size)
         case          
         when size.is_a?(Array) &amp;&amp; size.size == 2  # [320, 240]
           size
@@ -76,6 +67,20 @@ module Fleximage
         end
       end
       
+      # Converts a size object to an [x,y] array.  Acceptible formats are:
+      # 
+      # * 10
+      # * &quot;10&quot;
+      # * &quot;10x20&quot;
+      # * [10, 20]
+      #
+      # Usage:
+      #
+      #   x, y = size_to_xy(&quot;10x20&quot;)
+      def size_to_xy(size)
+        self.class.size_to_xy size
+      end
+      
       # Scale the image, respecting aspect ratio.  
       # Operation will happen in the main &lt;tt&gt;@image&lt;/tt&gt; unless you supply the +img+ argument
       # to operate on instead.</diff>
      <filename>lib/fleximage/operator/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -41,4 +41,20 @@ class Test::Unit::TestCase #:nodoc:
       
     end
   end
+  
+  def color_at(image, coords)
+    image.load_image.pixel_color(*coords)
+  end
+  
+  def to_color(rgb)
+    Magick::Pixel.new(*rgb)
+  end
+  
+  def assert_color(expected, coords, image)
+    coords    = coords.split('x').collect(&amp;:to_i)
+    expected  = to_color(expected)
+    actual    = color_at(image, coords)
+    
+    assert_equal(expected, actual, &quot;Wrong color at (#{coords.join(',')}).  Expected #{expected}, Got #{actual}&quot;)
+  end
 end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>888e17dd88d33f6229c76b4ae99394cf7a5d33d2</id>
    </parent>
  </parents>
  <author>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </author>
  <url>http://github.com/Squeegy/fleximage/commit/fb328f2b8c710ca5bd2f84d01cd11ec81af69a55</url>
  <id>fb328f2b8c710ca5bd2f84d01cd11ec81af69a55</id>
  <committed-date>2008-05-31T13:28:50-07:00</committed-date>
  <authored-date>2008-05-31T13:28:50-07:00</authored-date>
  <message>Added default_image option that allows you to use a default image defined by a size and optional fill color.  So instead of referencing a static image, you can use a '320x240' solid red image instead.</message>
  <tree>37f9f1a3ba0aae9ce99c5e289b2867e3ed95c7b8</tree>
  <committer>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </committer>
</commit>
