Hi,
I am new to Photoshop SDK plugin programming.
I want to write a filter, which will modify some (but not all) pixels transparently.
My input a rectangle selection with only 3 (rgb) chanels
My output 4 chanels with rgba.
I can't change the filterCase or number of planes...
Can you give me some suggestions that what can I do?
What I need change in PiPL? or in software?
Or can I find a good sample?
Thanks for your help,
Felix
Sunday, March 28, 2010
How to display BITMAP at runtime
Hey all....
I am new to Photoshop SDK CS2 plugin programming. Can anyone help me to find out any code or any information to display bitmap image on plugin dialog using photoshop API and not the Windows API or MFC. I am just using a simple Dialog extending PIDialog Class and placed a picture control at design time using resource editor in windows (Visual Studio).
When I pass the resourceID of an Image in design time to picture control it displays the image and plugin is also working good but don't know how to pass it at runtime.
thanks
How to display BITMAP at runtime
It sounds like you want something like a preview? There is code to do this
here (you can download
the plugin to see it working).
How to display BITMAP at runtime
Hi,
Thanks for your reply. My Plugin is an Automation type plugin and is visible in File/Automate menu. I am just opening a 'File Browse Dialog Box' through 'Open File' Button on Plugin Dialog to select a image file (*.bmp) then I want to display that image in thumbnail in Picture Control box on plugin Dialog (just like the File/Automate/Picture Package... plugin already included in Photoshop cs2).
I have also downloaded the code given by you. again thanks for that. I am trying to understand the code. But I think it is too much for just displaying an image in picture control.
Thanks
Oh, I see. Yes you're probably right, but wouldn't you need to use Win32 API to do it?
Well, Frankly Speaking I have no idea about that. Now, Instead of PIDialog Class, I am trying to use ADMDialog Suite. May be it will help to use Win32 API.
Thanks once again.
I am new to Photoshop SDK CS2 plugin programming. Can anyone help me to find out any code or any information to display bitmap image on plugin dialog using photoshop API and not the Windows API or MFC. I am just using a simple Dialog extending PIDialog Class and placed a picture control at design time using resource editor in windows (Visual Studio).
When I pass the resourceID of an Image in design time to picture control it displays the image and plugin is also working good but don't know how to pass it at runtime.
thanks
How to display BITMAP at runtime
It sounds like you want something like a preview? There is code to do this
here (you can download
the plugin to see it working).
How to display BITMAP at runtime
Hi,
Thanks for your reply. My Plugin is an Automation type plugin and is visible in File/Automate menu. I am just opening a 'File Browse Dialog Box' through 'Open File' Button on Plugin Dialog to select a image file (*.bmp) then I want to display that image in thumbnail in Picture Control box on plugin Dialog (just like the File/Automate/Picture Package... plugin already included in Photoshop cs2).
I have also downloaded the code given by you. again thanks for that. I am trying to understand the code. But I think it is too much for just displaying an image in picture control.
Thanks
Oh, I see. Yes you're probably right, but wouldn't you need to use Win32 API to do it?
Well, Frankly Speaking I have no idea about that. Now, Instead of PIDialog Class, I am trying to use ADMDialog Suite. May be it will help to use Win32 API.
Thanks once again.
How to get all layer coords, sizes, and...
I just downloaded the SDK and it seems like a vast amount of information for something pretty simple that I need to do.
I need to get all the sizes and coordinates/location refs of all layers (in reference to the document they are placed in) move them, and to output it all to txt/xml.
Basically I'm making an image/sprite packer plug-in similar to this but integrated will photoshop: http://homepage.ntlworld.com/config/imagepacker/
I'll probably end up using an action/scripting for the non-essential parts so all I need is the layer/movement refs for working with my packing algorithms.
Any help would be very much appreciated, even if it is just pointing out where to find this info in the SDK's PDFs, or kicking some code my way ;), it would be great.
How to get all layer coords, sizes, and...
James_Caldwell@adobeforums.com wrote:
%26gt; I need to get all the sizes and coordinates/location refs of all layers (in reference to the document they are placed in) move them, and to output it all to txt/xml.
You can do all of this easily enough with JavaScript. If you have large numbers
of layers (%26gt;%26gt;500) it may slow a bit if you code via the DOM, but you can always
drop down to lower-level code if you really need every last bit of performance
and want to stay in JS.
-X
How to get all layer coords, sizes, and...
Yes, but does javascript support FIO streams for saving/reading txt files in photoshop?
The only way I thought this would be possible was if there was some way to script custom log files, but it sounded too hackish to me.
James_Caldwell@adobeforums.com wrote:
%26gt; Yes, but does javascript support FIO streams for saving/reading txt files in photoshop?
The JavaScript in Adobe CS* products has fairly good File class supporting IO
plain ASCII, UTF, binary, and other encodings. I have libs/APIs for doing binary
IO for stuff like BE/LE words and IEEE754 floating point.
Search for the JavaScript Tools Guide for CS3 on the adobe site for docs on the
File and Folder classe. It's probably under devnet/bridge/
-X
Okay, I'm looking into scripting right now, but if I wanted this plug-in to be 7.0 compatible I would need to use C++ because Bridge was introduced with CS2, right?
James_Caldwell@adobeforums.com wrote:
%26gt; Okay, I'm looking into scripting right now, but if I wanted this plug-in to be 7.0 compatible I would need to use C++ because Bridge was introduced with CS, right?
No.
First off, scripts aren't plug-ins. It's a completely different programming model.
Second, the docs for File/Folder in CS3 are in Tools Guide which is provided
with Bridge (which is provided with PSCS3). File/Folder are available is PSCS3
with or without Bridge.
Third, you are fine going back to PS7. That's when scripting was introduced.
There are some quirks (BINARY encoding is not directly support, though I do have
a workaround), but it is easy enough to write scripts that are compatible from
PS7 through to CS3 provided you don't need any UI. If you need UI, you can only
go back to PSCS.
-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Right C++ is for the plug-in and scripts are run in the PS 7.0 with a plug-in, but I was trying to decide which route to go.
I have the SDK, but I'll just go with javascript for now.
I don't need any UI, if worst comes to worst I can just make different scripts most likely.
BTW, I can't test this at the moment as I don't have PS here, but maybe you can let me know if I'm doing anything wrong so far:
In javascript:
//====================================================
//Retrieving Layer data:
// ref acitve doc's top layer:
var my_layer = app.activeDocument.Artlayers[0];
var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
var my_layer_height = my_layer_bounds[3] //ref the layer height?
var my_string = '''' + my_layer_height; //put the height into a string?
//move the layer 100 pixels up and 100 pixels to the right:
my_layer.translate(100, 100);
//File Writing:
//create a new fileObj named file_name.txt:
var my_file = new fileObj(''file_name.txt'');
//write 3 strings on 3 lines:
my_file.write(my_string (''string_2'' , ''string_3''));
my_file.close();
//=====================================================
Also, doesn't Adobe have a free IDE for scripting Photoshop? Do you know where I can get/find it?
okay, ignore the above...
This is what I got now:
//====================================================
//Retrieving Layer data:
// ref acitve doc's top layer:
var my_layer = activeDocument.artLayers[0];
var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
var my_layer_height = ''my_layer_bounds[3]''; //ref the layer height?
var my_string = '''' + my_layer_height; //put the height into a string?
//move the layer 100 pixels up and 100 pixels to the right:
my_layer.translate(0.01, -0.01);
//File Writing:
my_file = new File(path.toString() + ''my_ps7.txt'');
//write 3 strings on 3 lines:
my_file.write(''my_ps7.txt'', ''string_3'');
my_file.close();
//=====================================================
James_Caldwell@adobeforums.com wrote:
%26gt;
%26gt; //Retrieving Layer data:
%26gt;
%26gt; // ref acitve doc's top layer:
%26gt; var my_layer = app.activeDocument.Artlayers[0];
should be
var my_layer = app.activeDocument.artLayers[0];
The description in the docs sometimes seems a bit confused WRT capitalization.
Classes and constants are capitalized, methods and properties aren't.
%26gt;
%26gt; var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
%26gt;
%26gt; var my_layer_height = my_layer_bounds[3] //ref the layer height?
Nope.
var my_layer_height = my_layer_bounds[3]-my_layer_bounds[1];
%26gt;
%26gt; var my_string = '''' + my_layer_height; //put the height into a string?
%26gt;
%26gt; //move the layer 100 pixels up and 100 pixels to the right:
%26gt; my_layer.translate(100, 100);
This goes down and to the right. The upper left corner is 0,0 in PS.
%26gt;
%26gt; //File Writing:
%26gt;
%26gt; //create a new fileObj named file_name.txt:
%26gt; var my_file = new fileObj(''file_name.txt'');
%26gt;
More like:
var my_file = new File(''/c/file_name.txt'');
You need a my_file.open(''w'');
%26gt; //write 3 strings on 3 lines:
%26gt; my_file.write(my_string (''string_2'' , ''string_3''));
my_file.writeln(my_string + ''\nstring_2\nstring_3''));
%26gt;
%26gt; my_file.close();
%26gt;
%26gt; //=====================================================
%26gt;
%26gt; Also, doesn't Adobe have a free IDE for scripting Photoshop? Do you know where I can get/find it?
It comes bundled with CS2 and CS3.
If you have any other questions, I suggest asking over on the PS scripting forum.
-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Hey thanks a lot, I actually got all of the file writing working because of your getter example on your PS script forum.
Do you prefer using that forum?
If so I'll just move over there.
James_Caldwell@adobeforums.com wrote:
%26gt; Do you prefer using that forum?
For JS stuff, yep.
%26gt;
%26gt; If so I'll just move over there.
I'm surprised Chris C. hasn't chased over there already :)
-X
Oh, btw I meant your execute example, not your getter.
Alright, I moved my posts over here at least until I get activated by your people.
http://www.adobeforums.com/cgi-bin/webx/.3bbf2765.3bc48105
I wrote a program (%26lt;a href=''http://www.telegraphics.com.au/sw/#psdparse''%26gt;psdparse%26lt;/a%26gt;) which extracts all this layer information from a PSD on disk, to XML if you wish (Photoshop is not required). Sample output:%26lt;br /%26gt;%26lt;br /%26gt;%26lt;pre%26gt;%26lt;br /%26gt;$ ./psdparse ../testpsd/slashtest.psd --xmlout%26lt;br /%26gt;%26lt;?xml version=''1.0''?%26gt;%26lt;br /%26gt;%26lt;PSD FILE='../testpsd/slashtest.psd' VERSION='1' CHANNELS='3' ROWS='72' COLUMNS='72' DEPTH='8' MODE='3' MODENAME='RGBColor'%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='Background' TOP='0' LEFT='0' BOTTOM='72' RIGHT='72' WIDTH='72' HEIGHT='72'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;TRANSPARENCYPROTECTED /%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='abc/def' TOP='26' LEFT='31' BOTTOM='57' RIGHT='68' WIDTH='37' HEIGHT='31'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='a/b/c/de/fg' TOP='12' LEFT='7' BOTTOM='43' RIGHT='44' WIDTH='37' HEIGHT='31'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;TRANSPARENCYPROTECTED /%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;COMPOSITE CHANNELS='3' HEIGHT='72' WIDTH='72'%26gt;%26lt;br /%26gt; %26lt;/COMPOSITE%26gt;%26lt;br /%26gt;%26lt;/PSD%26gt;%26lt;br /%26gt;%26lt;br /%26gt;%26lt;/pre%26gt;
Thanks Toby but the layer need to be manipulated using the dimension info right before they are saved so it's just more work to have another program do this.
Gotcha - I missed that bit :)
I need to get all the sizes and coordinates/location refs of all layers (in reference to the document they are placed in) move them, and to output it all to txt/xml.
Basically I'm making an image/sprite packer plug-in similar to this but integrated will photoshop: http://homepage.ntlworld.com/config/imagepacker/
I'll probably end up using an action/scripting for the non-essential parts so all I need is the layer/movement refs for working with my packing algorithms.
Any help would be very much appreciated, even if it is just pointing out where to find this info in the SDK's PDFs, or kicking some code my way ;), it would be great.
How to get all layer coords, sizes, and...
James_Caldwell@adobeforums.com wrote:
%26gt; I need to get all the sizes and coordinates/location refs of all layers (in reference to the document they are placed in) move them, and to output it all to txt/xml.
You can do all of this easily enough with JavaScript. If you have large numbers
of layers (%26gt;%26gt;500) it may slow a bit if you code via the DOM, but you can always
drop down to lower-level code if you really need every last bit of performance
and want to stay in JS.
-X
How to get all layer coords, sizes, and...
Yes, but does javascript support FIO streams for saving/reading txt files in photoshop?
The only way I thought this would be possible was if there was some way to script custom log files, but it sounded too hackish to me.
James_Caldwell@adobeforums.com wrote:
%26gt; Yes, but does javascript support FIO streams for saving/reading txt files in photoshop?
The JavaScript in Adobe CS* products has fairly good File class supporting IO
plain ASCII, UTF, binary, and other encodings. I have libs/APIs for doing binary
IO for stuff like BE/LE words and IEEE754 floating point.
Search for the JavaScript Tools Guide for CS3 on the adobe site for docs on the
File and Folder classe. It's probably under devnet/bridge/
-X
Okay, I'm looking into scripting right now, but if I wanted this plug-in to be 7.0 compatible I would need to use C++ because Bridge was introduced with CS2, right?
James_Caldwell@adobeforums.com wrote:
%26gt; Okay, I'm looking into scripting right now, but if I wanted this plug-in to be 7.0 compatible I would need to use C++ because Bridge was introduced with CS, right?
No.
First off, scripts aren't plug-ins. It's a completely different programming model.
Second, the docs for File/Folder in CS3 are in Tools Guide which is provided
with Bridge (which is provided with PSCS3). File/Folder are available is PSCS3
with or without Bridge.
Third, you are fine going back to PS7. That's when scripting was introduced.
There are some quirks (BINARY encoding is not directly support, though I do have
a workaround), but it is easy enough to write scripts that are compatible from
PS7 through to CS3 provided you don't need any UI. If you need UI, you can only
go back to PSCS.
-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Right C++ is for the plug-in and scripts are run in the PS 7.0 with a plug-in, but I was trying to decide which route to go.
I have the SDK, but I'll just go with javascript for now.
I don't need any UI, if worst comes to worst I can just make different scripts most likely.
BTW, I can't test this at the moment as I don't have PS here, but maybe you can let me know if I'm doing anything wrong so far:
In javascript:
//====================================================
//Retrieving Layer data:
// ref acitve doc's top layer:
var my_layer = app.activeDocument.Artlayers[0];
var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
var my_layer_height = my_layer_bounds[3] //ref the layer height?
var my_string = '''' + my_layer_height; //put the height into a string?
//move the layer 100 pixels up and 100 pixels to the right:
my_layer.translate(100, 100);
//File Writing:
//create a new fileObj named file_name.txt:
var my_file = new fileObj(''file_name.txt'');
//write 3 strings on 3 lines:
my_file.write(my_string (''string_2'' , ''string_3''));
my_file.close();
//=====================================================
Also, doesn't Adobe have a free IDE for scripting Photoshop? Do you know where I can get/find it?
okay, ignore the above...
This is what I got now:
//====================================================
//Retrieving Layer data:
// ref acitve doc's top layer:
var my_layer = activeDocument.artLayers[0];
var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
var my_layer_height = ''my_layer_bounds[3]''; //ref the layer height?
var my_string = '''' + my_layer_height; //put the height into a string?
//move the layer 100 pixels up and 100 pixels to the right:
my_layer.translate(0.01, -0.01);
//File Writing:
my_file = new File(path.toString() + ''my_ps7.txt'');
//write 3 strings on 3 lines:
my_file.write(''my_ps7.txt'', ''string_3'');
my_file.close();
//=====================================================
James_Caldwell@adobeforums.com wrote:
%26gt;
%26gt; //Retrieving Layer data:
%26gt;
%26gt; // ref acitve doc's top layer:
%26gt; var my_layer = app.activeDocument.Artlayers[0];
should be
var my_layer = app.activeDocument.artLayers[0];
The description in the docs sometimes seems a bit confused WRT capitalization.
Classes and constants are capitalized, methods and properties aren't.
%26gt;
%26gt; var my_layer_bounds = my_layer.bounds; // bounds returns an array of x, y, w, h
%26gt;
%26gt; var my_layer_height = my_layer_bounds[3] //ref the layer height?
Nope.
var my_layer_height = my_layer_bounds[3]-my_layer_bounds[1];
%26gt;
%26gt; var my_string = '''' + my_layer_height; //put the height into a string?
%26gt;
%26gt; //move the layer 100 pixels up and 100 pixels to the right:
%26gt; my_layer.translate(100, 100);
This goes down and to the right. The upper left corner is 0,0 in PS.
%26gt;
%26gt; //File Writing:
%26gt;
%26gt; //create a new fileObj named file_name.txt:
%26gt; var my_file = new fileObj(''file_name.txt'');
%26gt;
More like:
var my_file = new File(''/c/file_name.txt'');
You need a my_file.open(''w'');
%26gt; //write 3 strings on 3 lines:
%26gt; my_file.write(my_string (''string_2'' , ''string_3''));
my_file.writeln(my_string + ''\nstring_2\nstring_3''));
%26gt;
%26gt; my_file.close();
%26gt;
%26gt; //=====================================================
%26gt;
%26gt; Also, doesn't Adobe have a free IDE for scripting Photoshop? Do you know where I can get/find it?
It comes bundled with CS2 and CS3.
If you have any other questions, I suggest asking over on the PS scripting forum.
-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Hey thanks a lot, I actually got all of the file writing working because of your getter example on your PS script forum.
Do you prefer using that forum?
If so I'll just move over there.
James_Caldwell@adobeforums.com wrote:
%26gt; Do you prefer using that forum?
For JS stuff, yep.
%26gt;
%26gt; If so I'll just move over there.
I'm surprised Chris C. hasn't chased over there already :)
-X
Oh, btw I meant your execute example, not your getter.
Alright, I moved my posts over here at least until I get activated by your people.
http://www.adobeforums.com/cgi-bin/webx/.3bbf2765.3bc48105
I wrote a program (%26lt;a href=''http://www.telegraphics.com.au/sw/#psdparse''%26gt;psdparse%26lt;/a%26gt;) which extracts all this layer information from a PSD on disk, to XML if you wish (Photoshop is not required). Sample output:%26lt;br /%26gt;%26lt;br /%26gt;%26lt;pre%26gt;%26lt;br /%26gt;$ ./psdparse ../testpsd/slashtest.psd --xmlout%26lt;br /%26gt;%26lt;?xml version=''1.0''?%26gt;%26lt;br /%26gt;%26lt;PSD FILE='../testpsd/slashtest.psd' VERSION='1' CHANNELS='3' ROWS='72' COLUMNS='72' DEPTH='8' MODE='3' MODENAME='RGBColor'%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='Background' TOP='0' LEFT='0' BOTTOM='72' RIGHT='72' WIDTH='72' HEIGHT='72'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;TRANSPARENCYPROTECTED /%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='abc/def' TOP='26' LEFT='31' BOTTOM='57' RIGHT='68' WIDTH='37' HEIGHT='31'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;LAYER NAME='a/b/c/de/fg' TOP='12' LEFT='7' BOTTOM='43' RIGHT='44' WIDTH='37' HEIGHT='31'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;BLENDMODE OPACITY='100' CLIPPING='0'%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;NORMAL /%26gt; %26lt;!-- not parsed --%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;TRANSPARENCYPROTECTED /%26gt;%26lt;br /%26gt; %26amp;nbsp ; %26lt;/BLENDMODE%26gt;%26lt;br /%26gt; %26lt;/LAYER%26gt;%26lt;br /%26gt;%26lt;br /%26gt; %26lt;COMPOSITE CHANNELS='3' HEIGHT='72' WIDTH='72'%26gt;%26lt;br /%26gt; %26lt;/COMPOSITE%26gt;%26lt;br /%26gt;%26lt;/PSD%26gt;%26lt;br /%26gt;%26lt;br /%26gt;%26lt;/pre%26gt;
Thanks Toby but the layer need to be manipulated using the dimension info right before they are saved so it's just more work to have another program do this.
Gotcha - I missed that bit :)
How to get image RGB/16???????? (cont)
VRect currentRect;
int32 progressTotal = tilesVert * tilesHoriz;
int32 progressDone = 0;
// process each tile in order
currentRect.top = 0;
currentRect.left = 0;
currentRect.bottom = tileHeight;
currentRect.right = tileWidth;
// don't go past the document bounds
if (currentRect.bottom %26gt; docHeight)
currentRect.bottom = docHeight;
if (currentRect.right %26gt; docWidth)
currentRect.right = docWidth;
pixelMemoryDesc.rowBits = (currentRect.right - currentRect.left) *
readChannelDesc-%26gt;depth;
// read
while(readChannelDesc != NULL)
{
bigError = sPSChannelProcs-%26gt;ReadPixelsFromLevel(
readChannelDesc-%26gt;port, 0, %26amp;currentRect, %26amp;pixelMemoryDesc);
if (bigError)
{
error = filterBadParameters;
throw(this);
}
/************************/
unsigned char *imageData;// for image RGB/8, with RGB/16 is unsigned short
long temp = tileHeight * tileWidth * readChannelDesc-%26gt;depth/8;
imageData = new unsigned char[temp];// for image RGB/8, with RGB/16 is unsigned short
memcpy(imageData, pixelMemoryDesc.data, temp);
FILE *file;
file = fopen(''C:\\abc.txt'', ''ab'');
if(file == NULL)
return;
fwrite(imageData, sizeof(unsigned char), temp, file);// for image RGB/8, with RGB/16 is unsigned short
fclose(file);
readChannelDesc = readChannelDesc-%26gt;next;
}
return;
}
////end of customizing/////
- then we use a project to read ''abc.txt'' to get image:
////////// function of button that is clicked, the image is shown
void CPixelDlg::OnBtnSetPixel()
{
// TODO: Add your control notification handler code here
//////////////////////////////////////////////////////////
// POINT point;
//////////////////////////////////////////////////
unsigned char*memblock;// for image RGB/8, with RGB/16 is unsigned short
memblock = new unsigned char[HEIGH * WIDTH *3];// HEIGH , WIDTH is assigned by hard code// for image RGB/8, with RGB/16 is unsigned short
FILE *file;
file = fopen(''C:\\abc.txt'', ''rb'');
if( file == NULL)
{
return;
}
else
{
fread(memblock, sizeof(unsigned char), HEIGH * WIDTH *3, file);// for image RGB/8, with RGB/16 is unsigned short
fclose(file);
}
//////////////////////////////////////////////////
CClientDC dc(this);
int i = 0;
int j=0;
int k = 0;
for( i = 0; i %26lt; WIDTH; i++)
{
for( j = 0; j %26lt; HEIGH; j++)
{
if (k%26gt;WIDTH*HEIGH*3-3)
break;
dc.SetPixel(j, i, RGB(memblock[k],memblock[k+WIDTH*HEIGH],memblock[k+2*WIDTH*HEIGH]));
k+=1;
}
}
}
2. that code is ok for Image RGB/8. But with image RGB/16, now we don't know how Photoshop stores image data, and how to get image data to show???
Please help me?
Thanks,
lips
int32 progressTotal = tilesVert * tilesHoriz;
int32 progressDone = 0;
// process each tile in order
currentRect.top = 0;
currentRect.left = 0;
currentRect.bottom = tileHeight;
currentRect.right = tileWidth;
// don't go past the document bounds
if (currentRect.bottom %26gt; docHeight)
currentRect.bottom = docHeight;
if (currentRect.right %26gt; docWidth)
currentRect.right = docWidth;
pixelMemoryDesc.rowBits = (currentRect.right - currentRect.left) *
readChannelDesc-%26gt;depth;
// read
while(readChannelDesc != NULL)
{
bigError = sPSChannelProcs-%26gt;ReadPixelsFromLevel(
readChannelDesc-%26gt;port, 0, %26amp;currentRect, %26amp;pixelMemoryDesc);
if (bigError)
{
error = filterBadParameters;
throw(this);
}
/************************/
unsigned char *imageData;// for image RGB/8, with RGB/16 is unsigned short
long temp = tileHeight * tileWidth * readChannelDesc-%26gt;depth/8;
imageData = new unsigned char[temp];// for image RGB/8, with RGB/16 is unsigned short
memcpy(imageData, pixelMemoryDesc.data, temp);
FILE *file;
file = fopen(''C:\\abc.txt'', ''ab'');
if(file == NULL)
return;
fwrite(imageData, sizeof(unsigned char), temp, file);// for image RGB/8, with RGB/16 is unsigned short
fclose(file);
readChannelDesc = readChannelDesc-%26gt;next;
}
return;
}
////end of customizing/////
- then we use a project to read ''abc.txt'' to get image:
////////// function of button that is clicked, the image is shown
void CPixelDlg::OnBtnSetPixel()
{
// TODO: Add your control notification handler code here
//////////////////////////////////////////////////////////
// POINT point;
//////////////////////////////////////////////////
unsigned char*memblock;// for image RGB/8, with RGB/16 is unsigned short
memblock = new unsigned char[HEIGH * WIDTH *3];// HEIGH , WIDTH is assigned by hard code// for image RGB/8, with RGB/16 is unsigned short
FILE *file;
file = fopen(''C:\\abc.txt'', ''rb'');
if( file == NULL)
{
return;
}
else
{
fread(memblock, sizeof(unsigned char), HEIGH * WIDTH *3, file);// for image RGB/8, with RGB/16 is unsigned short
fclose(file);
}
//////////////////////////////////////////////////
CClientDC dc(this);
int i = 0;
int j=0;
int k = 0;
for( i = 0; i %26lt; WIDTH; i++)
{
for( j = 0; j %26lt; HEIGH; j++)
{
if (k%26gt;WIDTH*HEIGH*3-3)
break;
dc.SetPixel(j, i, RGB(memblock[k],memblock[k+WIDTH*HEIGH],memblock[k+2*WIDTH*HEIGH]));
k+=1;
}
}
}
2. that code is ok for Image RGB/8. But with image RGB/16, now we don't know how Photoshop stores image data, and how to get image data to show???
Please help me?
Thanks,
How to get image RGB/16????????
My problem is:%26lt;br /%26gt;1. When you start my project with Hidden. I customize it to:%26lt;br /%26gt; - get first memory address of image RGB/8 and store data of image in file ''abc.txt'':%26lt;br /%26gt;%26lt;br /%26gt;/////Code is customized/////////////////////////////////////////////////%26lt;br /%26gt;%26lt;br /%26gt;/////Declare global parameter///////%26lt;br /%26gt;#include ''PITerminology.h''%26lt;br /%26gt;#include %26lt;vector%26gt;%26lt;br /%26gt;#include %26lt;time.h%26gt;%26lt;br /%26gt;%26lt;br /%26gt;using namespace std;%26lt;br /%26gt;%26lt;br /%26gt;#define HERROR(FUNC) if (true) { error = FUNC; if (error) throw(this); } else%26lt;br /%26gt;ReadChannelDesc * readChannelDesc;/// code is customized%26lt;br /%26gt;/////end of Declare global parameter///////%26lt;br /%26gt;%26lt;br /%26gt;ReadChannelDesc * HiddenPlugin::FindChannelDesc(string %26amp; name)%26lt;br /%26gt;{%26lt;br /%26gt; ReadChannelDesc * readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetCompositeChannels;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetLayerMask;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;targetTransparency;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;alphaChannels;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; readChannelDesc = filterRecord-%26gt;documentInfo-%26gt;selection;%26lt;br /%26gt; while (readChannelDesc != NULL)%26lt;br /%26gt; {%26lt;br /%26gt; //if (name.compare(readChannelDesc-%26gt;name) == 0)%26lt;br /%26gt; %26amp;nbsp ; return readChannelDesc;%26lt;br /%26gt; //readChannelDesc = readChannelDesc-%26gt;next;%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; return NULL;%26lt;br /%26gt;}%26lt;br /%26gt;%26lt;br /%26gt;void HiddenPlugin::Write(void)%26lt;br /%26gt;{%26lt;br /%26gt; // find out which channel we are writing to%26lt;br /%26gt; // this was already read in from the scripting parameters%26lt;br /%26gt; %26lt;br /%26gt; ReadChannelDesc * readChannelDesc = NULL;%26lt;br /%26gt; %26lt;br /%26gt; //if (channelName.empty())%26lt;br /%26gt; // readChannelDesc = FindChannelDesc(channelType);%26lt;br /%26gt; //else%26lt;br /%26gt; readChannelDesc = FindChannelDesc(channelName);%26lt;br /%26gt; if (readChannelDesc == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt; %26lt;br /%26gt;%26lt;br /%26gt; // check some things to see if we should continue%26lt;br /%26gt; if (readChannelDesc-%26gt;tileSize.v == 0)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; if (readChannelDesc-%26gt;tileSize.h == 0)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; Boolean canWrite = false;%26lt;br /%26gt; if (readChannelDesc-%26gt;writePort == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt; %26lt;br /%26gt; int32 bigError = sPSChannelProcs-%26gt;CanWrite(readChannelDesc-%26gt;writePort, %26amp;canWrite);%26lt;br /%26gt; if (bigError != 0 || !canWrite) %26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; // set up for tiling the document%26lt;br /%26gt; int32 docHeight = readChannelDesc-%26gt;bounds.bottom - readChannelDesc-%26gt;bounds.top;%26lt;br /%26gt; int32 docWidth = readChannelDesc-%26gt;bounds.right - readChannelDesc-%26gt;bounds.left;%26lt;br /%26gt; int32 tileHeight = docHeight;/*readChannelDesc-%26gt;tileSize.v;*/%26lt;br /%26gt; int32 tileWidth = docWidth;/*readChannelDesc-%26gt;tileSize.h;*/%26lt;br /%26gt; %26lt;br /%26gt; uint32 tilesVert = (tileHeight - 1 + docHeight) / tileHeight;%26lt;br /%26gt; %26lt;br /%26gt; uint32 tilesHoriz = (tileWidth - 1 + docWidth) / tileWidth;%26lt;br /%26gt;%26lt;br /%26gt; uint32 channelSize = tileHeight * tileWidth * readChannelDesc-%26gt;depth / 8;%26lt;br /%26gt;%26lt;br /%26gt; // get a buffer that we can read and write into%26lt;br /%26gt; Ptr pixelData = sPSBuffer-%26gt;New(NULL, channelSize); %26lt;br /%26gt; if (pixelData == NULL)%26lt;br /%26gt; {%26lt;br /%26gt; error = filterBadParameters;%26lt;br /%26gt; throw(this);%26lt;br /%26gt; }%26lt;br /%26gt;%26lt;br /%26gt; // set up the PixelMemoryDesc for the channel ports suite%26lt;br /%26gt; PixelMemoryDesc pixelMemoryDesc;%26lt;br /%26gt; pixelMemoryDesc.data = pixelData;%26lt;br /%26gt; pixelMemoryDesc.colBits = readChannelDesc-%26gt;depth;%26lt;br /%26gt; pixelMemoryDesc.bitOffset = 0;%26lt;br /%26gt; pixelMemoryDesc.depth = readChannelDesc-%26gt;depth;%26lt;br /%26gt;/// Please read next
CS2 resets
I installed CS2 a few months ago. occassionally when I load Photoshop it reverts to some default mode. My printer settings are changed, my grid settings are changed, workspace back to default, and several other changes are made. I put everything as I want it but at sometime later when I laod Photoshop it will revert back to some default configuration. Saving my workspace does not prvent the reversion but I can get my workspace back using the saved workspace. All other settings must be changed manually. I tried calling tech help but am unable to get through.
Any help is appreciated.
Paul
Any help is appreciated.
Paul
Accessing Movie Layers through the...
Howdy Guys,
I've learned that Photoshop just got the movie layers with this recent release but couldnt find any way of accessing / exporting the layer data through the Plugin SDK.
I need to export movie data from Photoshop CS3 - is there a way to access movie data through the File Format- or the Export-Modules?
Is there possibly a workaround that would allow me to export such movie layer frame by frame - maybe using a custom action which then invokes my custom plugin?
If confronted with that challenge, how would you do that?
Thanks for any answer - I would really highly appreciate any hint. Heck, I would even donate a really cute TShirt to the first answer that enables me to accomplish that challenge.
cheers,
Till
Accessing Movie Layers through the...
Sry for answering my own posting - but is there REALLY no way of accessing movie layers through the SDK???
It is hard to believe that there are no options available.
My T-Shirt offer for the first hint that leads to success is still up! ;)
cheers,
Till
I've learned that Photoshop just got the movie layers with this recent release but couldnt find any way of accessing / exporting the layer data through the Plugin SDK.
I need to export movie data from Photoshop CS3 - is there a way to access movie data through the File Format- or the Export-Modules?
Is there possibly a workaround that would allow me to export such movie layer frame by frame - maybe using a custom action which then invokes my custom plugin?
If confronted with that challenge, how would you do that?
Thanks for any answer - I would really highly appreciate any hint. Heck, I would even donate a really cute TShirt to the first answer that enables me to accomplish that challenge.
cheers,
Till
Accessing Movie Layers through the...
Sry for answering my own posting - but is there REALLY no way of accessing movie layers through the SDK???
It is hard to believe that there are no options available.
My T-Shirt offer for the first hint that leads to success is still up! ;)
cheers,
Till
Subscribe to:
Comments
(Atom)