I see moveImageSection() but there is no copyImageSection(), I’m looking for a simple way to transfer a portion of an Image into another image, without any rescaling or format conversion. It seems the only way is to create a Graphics object. Which seems a little bulky for a simple operation.

I rolled my own easily enough

void copyImageSection (Image destImage, int destX, int destY,
                              Image sourceImage, int sourceX, int sourceY,
                              int width, int height)
  jassert (destImage.getFormat () == sourceImage.getFormat ());

  Image::BitmapData src (sourceImage, sourceX, sourceY, width, height,

  Image::BitmapData dest (destImage, destX, destY, width, height,

  for (int y = 0; y < height; ++y)
    memcpy (dest.getLinePointer (y),
            src.getLinePointer (y),
            width * src.pixelStride);

I’d recommend doing it with a Graphics object if possible - remember that Images may one day be stored in graphics-card memory, etc, so getting and setting the bits may actually be more expensive than just blitting it. (Not to mention that there’s less scope for errors)

In theory yes but this is a grayscale image and I am using some custom routines to map it to an RGB image with a color lookup table. Speaking of which…Juce makes it difficult to do such things because it treats a 1-channel image as an “Alpha channel”. For example when drawing into a 1-channel image it uses the alpha value of colors instead of the luminance.