Menu

#2 PdfJpegImage::LoadFromMem

open
nobody
None
5
2004-10-31
2004-10-31
No

Hi Takeshi,

can you please add the following function.

Thanks,
Pascal

-----------------------------------
// 10.10.2004 (pdrecker at users.sourceforge.net)
void
PdfJpegImage::LoadFromMem(unsigned char *byteData,
unsigned int len, int image_width, int image_height,
int jpeg_color_space, int bits_per_component)
{
FreeImage();

try
{
fWidth = image_width;
fHeight = image_height;

fBitsPerComponent = bits_per_component;

AddFilter(PDF_FILTER_DCT_DECODE);

if (jpeg_color_space == 1)
fColorSpace = PDF_CS_DEVICE_GRAY;
else if (jpeg_color_space == 3)
fColorSpace = PDF_CS_DEVICE_RGB;
else
fColorSpace = PDF_CS_DEVICE_CMYK; // supported? !!!
}
catch (PdfException& e)
{
throw;
}

GetStream()->Write(byteData, len);

fHasImage = true;
}

Discussion

  • Thomas Nimstad

    Thomas Nimstad - 2004-12-06

    Logged In: YES
    user_id=695611

    Yeah. Great!!!

    But if would be a little nicer to dont have to parse the
    jpeg data outside, just do a LoadFromMem(unsigned
    char* byteData, unsigned int len).

    Would also like to have the correspondig function
    PdfPngImage::LoadFromMem() and the function
    PdfImage::Duplicate().

     
  • Alessandro Portale

    Logged In: YES
    user_id=1082798

    That would be great also for me!
    Encoded outside or passed as raw data and then encoded by
    choice: both would be nice.

    I for example would like to insert a zip compressed CMYK
    image, from memory.

     
  • Stuart

    Stuart - 2006-06-07

    Logged In: YES
    user_id=1535544

    Hi.

    I've added a method LoadFromMem, I'd like to know where/how
    to submit a patch so it can be reviewed and added to code.

    Regards,

    Stuart S.

     

Log in to post a comment.