Index: pdmodel/graphics/color/PDColorSpaceFactory.java
===================================================================
--- pdmodel/graphics/color/PDColorSpaceFactory.java	(revision 811107)
+++ pdmodel/graphics/color/PDColorSpaceFactory.java	(working copy)
@@ -20,6 +20,7 @@
 import java.awt.color.ICC_ColorSpace;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Map;
 
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
@@ -56,10 +57,25 @@
      */
     public static PDColorSpace createColorSpace( COSBase colorSpace ) throws IOException
     {
+        return createColorSpace( colorSpace, null );
+    }
+
+    /**
+     * This will create the correct color space given the name.
+     *
+     * @param colorSpace The color space object.
+     * @param colorSpaces The ColorSpace dictionary from the current resources, if any.
+     *
+     * @return The color space.
+     *
+     * @throws IOException If the color space name is unknown.
+     */
+    public static PDColorSpace createColorSpace( COSBase colorSpace, Map colorSpaces ) throws IOException
+    {
         PDColorSpace retval = null;
         if( colorSpace instanceof COSName )
         {
-            retval = createColorSpace( ((COSName)colorSpace).getName() );
+            retval = createColorSpace( ((COSName)colorSpace).getName(), colorSpaces );
         }
         else if( colorSpace instanceof COSArray )
         {
@@ -129,6 +145,21 @@
      */
     public static PDColorSpace createColorSpace( String colorSpaceName ) throws IOException
     {
+        return createColorSpace(colorSpaceName, null);
+    }
+
+    /**
+     * This will create the correct color space given the name.
+     *
+     * @param colorSpaceName The name of the colorspace.
+     * @param colorSpaces The ColorSpace dictionary from the current resources, if any.
+     *
+     * @return The color space.
+     *
+     * @throws IOException If the color space name is unknown.
+     */
+    public static PDColorSpace createColorSpace( String colorSpaceName, Map colorSpaces ) throws IOException
+    {
         PDColorSpace cs = null;
         if( colorSpaceName.equals( PDDeviceCMYK.NAME ) ||
                  colorSpaceName.equals( PDDeviceCMYK.ABBREVIATED_NAME ) )
@@ -145,6 +176,10 @@
         {
             cs = new PDDeviceGray();
         }
+        else if( colorSpaces != null && colorSpaces.get( colorSpaceName ) != null )
+        {
+            cs = (PDColorSpace)colorSpaces.get( colorSpaceName );
+        }
         else if( colorSpaceName.equals( PDLab.NAME ) )
         {
             cs = new PDLab();
Index: pdmodel/graphics/xobject/PDInlinedImage.java
===================================================================
--- pdmodel/graphics/xobject/PDInlinedImage.java	(revision 811107)
+++ pdmodel/graphics/xobject/PDInlinedImage.java	(working copy)
@@ -27,6 +27,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.pdfbox.filter.Filter;
 import org.apache.pdfbox.filter.FilterManager;
@@ -94,6 +95,21 @@
      */
     public BufferedImage createImage() throws IOException
     {
+        return createImage( null );
+    }
+
+    /**
+     * This will take the inlined image information and create a java.awt.Image from
+     * it.
+     * 
+     * @param colorSpaces The ColorSpace dictionary from the current resources, if any.
+     *
+     * @return The image that this object represents.
+     *
+     * @throws IOException If there is an error creating the image.
+     */
+    public BufferedImage createImage( Map colorSpaces ) throws IOException
+    {
         /*
          * This was the previous implementation, not sure which is better right now.
          *         byte[] transparentColors = new byte[]{(byte)0xFF,(byte)0xFF};
@@ -118,12 +134,12 @@
 
 
         //verify again pci32.pdf before changing below
-        PDColorSpace pcs = params.getColorSpace();
+        PDColorSpace pcs = params.getColorSpace( colorSpaces );
         ColorModel colorModel = null;
         if(pcs != null)
         {
             colorModel =
-                params.getColorSpace().createColorModel(
+                pcs.createColorModel(
                         params.getBitsPerComponent() );
         }
         else
Index: util/ImageParameters.java
===================================================================
--- util/ImageParameters.java	(revision 811107)
+++ util/ImageParameters.java	(working copy)
@@ -29,6 +29,7 @@
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 
 /**
  * This contains all of the image parameters for in inlined image.
@@ -120,11 +121,25 @@
      */
     public PDColorSpace getColorSpace() throws IOException
     {
+        return getColorSpace( null );
+    }
+    
+    /**
+     * This will get the color space or null if none exists.
+     *
+     * @param colorSpaces The ColorSpace dictionary from the current resources, if any.
+     *
+     * @return The color space for this image.
+     *
+     * @throws IOException If there is an error getting the colorspace.
+     */
+    public PDColorSpace getColorSpace( Map colorSpaces ) throws IOException
+    {
         COSBase cs = getCOSObject( "CS", "ColorSpace" );
         PDColorSpace retval = null;
         if( cs != null )
         {
-            retval = PDColorSpaceFactory.createColorSpace( cs );
+            retval = PDColorSpaceFactory.createColorSpace( cs, colorSpaces );
         }
         return retval;
     }
Index: util/operator/pagedrawer/BeginInlineImage.java
===================================================================
--- util/operator/pagedrawer/BeginInlineImage.java	(revision 811107)
+++ util/operator/pagedrawer/BeginInlineImage.java	(working copy)
@@ -54,7 +54,7 @@
         PDInlinedImage image = new PDInlinedImage();
         image.setImageParameters( params );
         image.setImageData( operator.getImageData() );
-        BufferedImage awtImage = image.createImage();
+        BufferedImage awtImage = image.createImage( context.getColorSpaces() );
 
         Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix();
 
Index: util/operator/SetNonStrokingColorSpace.java
===================================================================
--- util/operator/SetNonStrokingColorSpace.java	(revision 811107)
+++ util/operator/SetNonStrokingColorSpace.java	(working copy)
@@ -49,16 +49,7 @@
     {
 //      (PDF 1.1) Set color space for stroking operations
         COSName name = (COSName)arguments.get( 0 );
-        PDColorSpace cs = null;
-        Map colorSpaces = context.getColorSpaces();
-        if( colorSpaces != null )
-        {
-             cs = (PDColorSpace)colorSpaces.get( name.getName() );
-        }
-        if( cs == null )
-        {
-            cs = PDColorSpaceFactory.createColorSpace( name );
-        }
+        PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces() );
         PDColorSpaceInstance colorInstance = context.getGraphicsState().getNonStrokingColorSpace();
         colorInstance.setColorSpace( cs );
         int numComponents = cs.getNumberOfComponents();
Index: util/operator/SetStrokingColorSpace.java
===================================================================
--- util/operator/SetStrokingColorSpace.java	(revision 811107)
+++ util/operator/SetStrokingColorSpace.java	(working copy)
@@ -52,16 +52,7 @@
     {
         //(PDF 1.1) Set color space for stroking operations
         COSName name = (COSName)arguments.get( 0 );
-        Map colorSpaces = context.getColorSpaces();
-        PDColorSpace cs = null;
-        if( colorSpaces != null )
-        {
-            cs = (PDColorSpace)colorSpaces.get( name.getName() );
-        }
-        if( cs == null )
-        {
-            cs = PDColorSpaceFactory.createColorSpace( name );
-        }
+        PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces() );
         PDColorSpaceInstance colorInstance = context.getGraphicsState().getStrokingColorSpace();
         colorInstance.setColorSpace( cs );
         int numComponents = cs.getNumberOfComponents();
