Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get RGB Pixel Data from Document

Community Beginner ,
Jan 06, 2010 Jan 06, 2010

I need the ability to retreive raster RGB pixel data from a document. I'm trying to use the RasterizeDocument suite; however, the suite continues to send errors.

AIRasterizeSettings settings;

AIArtHandle *rast =

new AIArtHandle();

ASErr error = kNoErr;

error = sAIRasterize->RasterizeDocument(&settings,kPlaceAboveAll,NULL,rast,NULL,kRasterizeOptionsNone);

the error number I am receiving is 1313166163. I have yet to figure out what this number is in terms of error codes.

If there is a better way to get this data, or any ideas on how to get this to work, it would be greatly apprecieted.

Thanks in advance,

Jeremy

TOPICS
SDK
5.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Beginner ,
Jan 07, 2010 Jan 07, 2010

Reason for error is with this code the top layer must be unlocked and visible to work; however, on larger documents, it only rasterizes the top portion and then stopes politely. Any Ideas?

Jeremy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 18, 2010 Jan 18, 2010

If you want to analyze an error code, view it as hex. If you have a number like 0x49463827 you break it into to four pieces: 0x49, 0x46, 0x38, & 0x27. Each of those is a character code (I think 0x49 is 'A'). That should spell out a four-letter code, if the error code is even meaningful (its not always).

As for your problem, there is a limit to the size of what you can rasterize. Check the error code. If it looks legit, you can search for it in the headers, many of the error codes are documented. They look something like this:

const AIErr kAISomeKindOfError = 't!fd';

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 19, 2010 Jan 19, 2010

I got the rasterize working; however, getting the RGB data from a tile is now giving me an amazing amount of trouble. Either the system is running out of memory (I got it to work, but only by allocating around 100 bytes per pixel) or it is giving me gibberish for the data (data that only consists of FF, 00, and CD hex values).

AIArtHandle rast;

error = sAIRasterize->RasterizeDocument(&settings,kPlaceAboveAll,NULL,&rast,ProgressBar,kRasterizeOptionsDoLayers); //this works

if(error) return;

AIRasterRecord record;

sAIRaster->GetRasterInfo(rast,&record);

AISlice slice;

slice.front = 0;

slice.back = 3;

slice.top = record.bounds.top;

slice.left = record.bounds.left;

slice.right = record.bounds.right;

slice.bottom = record.bounds.bottom;

AITile tile;

for(int i =0; i < kMaxChannels; i ++){

tile.channelInterleave = 0;

}

tile.channelInterleave[0] = 0;

tile.channelInterleave[1] = 1;

tile.channelInterleave[2] = 2;

tile.channelInterleave[3] = 3;

tile.data =

new int[slice.right * slice.bottom * 10]; //*10 because of memory issues

tile.colBytes = 3; //3 colors?

tile.planeBytes = 0;

tile.rowBytes = slice.right * slice.bottom;

tile.bounds = slice;

AISlice work;

work = slice;

error = sAIRaster->GetRasterTile(rast,&slice,&tile,&work);

thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 25, 2010 Jan 25, 2010

Anybody have any ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 27, 2010 Jan 27, 2010

This is hardly my forté (I'm more about the vectors than the pixels ) but I can give it a crack.

I think most of what you have is right, but a few things are off. Specifically, I think you need to replace the following two assignments of tile.rowBytes & tile.data with this:

tile.rowBytes = record.bounds.right * tile.colBytes;

tile.data = new char[tile.rowBytes * record.bounds.bottom];

Note that its 'new char' not 'new int' -- you want raw bytes, not integers (which are four bytes).  Also, note that your code is hard-coded for ignoring alpha. If you want to get alpha information, you basically change '3' to '4'. colBytes is the number of bytes in a colour, which is 3 when its just RGB, but would be four if it was RGBA. You'd also need to update slice.back to 4. I forget what the 'back' refers to, but I think it indicates colour channels or something like that. At any rate, try the first two lines above first just to see if you get useful data back. If that works, then you can try and get alpha working (if you even care )

Hopefully that helps -- let me know how it goes!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 27, 2010 Jan 27, 2010
LATEST

I forgot to mention, but obviously you'll need to reorder some of the assignments there. No point using tile.rowBytes before you've assigned to it!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines