如何把PSD(photoshop)的图像转为.BMP或.jpg格式 求救(100分)

  • 主题发起人 主题发起人 huanyu
  • 开始时间 开始时间
H

huanyu

Unregistered / Unconfirmed
GUEST, unregistred user!
我急要把一个PSD 格式的文件转为格式在程序中怎么做那位知道那有源程序。
 
这很好办!
首先,进入photoshop,调出你的PSD图像;
第二,从File|Save Copy to ...并选择*.bmp/*.Jpg等格式的文件;
第三,起个文件名,并确定即可!
很方便的!
 
好有趣,我觉得利用OLE控制PHOTOSHOP是个方法,给点资料给你:

Automating Adobe Photoshop
{work in progress}

Contents
Sources of information
Quick reference
How do I?

--------------------------------------------------------------------------------

Sources of information
Web sites Delphi sites
For catching events, or general COM concepts, see also
Binh Ly's tutorials
Non-Delphi sites
Adobe Photoshop 5.5 SDK



Back to top

--------------------------------------------------------------------------------

Quick reference
The Photoshop type library exposes the following interfaces (and their dispinterface equivalents):

IAction
IActions
IActionControl
IActionDescriptor
IActionList
IActionReference
IAutoPSDoc
IPhotoshopApplication

As you can see, Photoshop automation revolves around Actions. You can easily automate something by creating it as an Action in Photoshop, then playing it from Delphi using the IAction.Play or IPhotoshopApplication.PlayAction methods.

Back to top

--------------------------------------------------------------------------------

IPhotoshopApplication - major methods and properties
function Open(const fileName: WideString): IAutoPSDoc;
function PlayAction(const fileName: WideString): WordBool;

procedure Quit;

function MakeControlObject: IActionControl;
function MakeDescriptor: IActionDescriptor;
function MakeList: IActionList;
function MakeReference: IActionReference;


property Actions: IActions read Get_Actions;
property FullName: WideString read Get_FullName;
property Visible: WordBool read Get_Visible write Set_Visible;

Back to top

--------------------------------------------------------------------------------

IAutoPSDoc - major methods and properties
procedure Activate;
procedure Close;
procedure SaveTo(const fileName: WideString);


property Title: WideString read Get_Title;

Back to top

--------------------------------------------------------------------------------

IAction - methods and properties
procedure Play; safecall;


function Get_name: WideString;
property name: WideString read Get_name;

Back to top

--------------------------------------------------------------------------------

IActions - methods and properties
function Get_count: Integer;
function Get_Item(index: Integer): IAction;
function Get__NewEnum: IUnknown;

property count: Integer read Get_count;
property Item[index: Integer]: IAction read Get_Item; default;
property _NewEnum: IUnknown read Get__NewEnum;

Back to top

--------------------------------------------------------------------------------

IActionControl - methods
function Play(eventID: Integer;
const parameters: IActionDescriptor;
dialogOptions: Integer): IActionDescriptor;
procedure GetActionProperty(const reference: IActionReference;
out propertyDesc: IActionDescriptor);


procedure StringIDToTypeID(const stringID: WideString; out typeID: Integer);
procedure TypeIDToStringID(typeID: Integer; out stringID: WideString);

Back to top

--------------------------------------------------------------------------------

IActionDescriptor - methods
procedure IsEqual(const otherDesc: IActionDescriptor; out IsEqual: WordBool);
procedure Erase(key: Integer);
procedure Clear;


procedure GetType(key: Integer; out type_: Integer);
procedure GetKey(index: Integer; out key: Integer);
procedure HasKey(key: Integer; out HasKey: WordBool);
procedure GetCount(out count: Integer);


procedure GetInteger(key: Integer; out retval: Integer);
procedure PutInteger(key: Integer; value: Integer);
procedure GetDouble(key: Integer; out retval: Double);
procedure PutDouble(key: Integer; value: Double);
procedure GetUnitDouble(key: Integer; out unitID: Integer; out retval: Double);
procedure PutUnitDouble(key: Integer; unitID: Integer; value: Double);
procedure GetString(key: Integer; out retval: WideString);
procedure PutString(key: Integer; const value: WideString);
procedure GetBoolean(key: Integer; out retval: WordBool);
procedure PutBoolean(key: Integer; value: WordBool);


procedure GetList(key: Integer; out list: IActionList);
procedure PutList(key: Integer; const list: IActionList);
procedure GetObject(key: Integer; out classID: Integer;
out retval: IActionDescriptor);
procedure PutObject(key: Integer; classID: Integer; const value: IActionDescriptor);
procedure GetGlobalObject(key: Integer; out classID: Integer;
out retval: IActionDescriptor);
procedure PutGlobalObject(key: Integer; classID: Integer; const value: IActionDescriptor);
procedure GetEnumerated(key: Integer; out enumType: Integer; out value: Integer);
procedure PutEnumerated(key: Integer; enumType: Integer; value: Integer);
procedure GetReference(key: Integer; out reference: IActionReference);
procedure PutReference(key: Integer; const reference: IActionReference);
procedure GetClass(key: Integer; out classID: Integer);
procedure PutClass(key: Integer; classID: Integer);
procedure GetGlobalClass(key: Integer; out classID: Integer);
procedure PutGlobalClass(key: Integer; classID: Integer);
procedure GetPath(key: Integer; out pathString: WideString);
procedure PutPath(key: Integer; const pathString: WideString);

Back to top

--------------------------------------------------------------------------------

IActionList - methods
procedure GetType(index: Integer; out value: Integer);
procedure GetCount(out value: Integer);


procedure GetInteger(index: Integer; out value: Integer);
procedure PutInteger(value: Integer);
procedure GetDouble(index: Integer; out value: Double);
procedure PutDouble(value: Double);
procedure GetUnitDouble(index: Integer; out unit_: Integer; out value: Double);
procedure PutUnitDouble(unit_: Integer; value: Double);
procedure GetString(index: Integer; out str: WideString);
procedure PutString(const str: WideString);
procedure GetBoolean(index: Integer; out value: WordBool);
procedure PutBoolean(value: WordBool);


procedure GetList(index: Integer; out actionList: IActionList);
procedure PutList(const actionList: IActionList);
procedure GetObject(index: Integer; out type_: Integer; out value: IActionDescriptor);
procedure PutObject(type_: Integer; const value: IActionDescriptor);
procedure GetGlobalObject(index: Integer; out type_: Integer;
out value: IActionDescriptor);
procedure PutGlobalObject(type_: Integer; const value: IActionDescriptor);
procedure GetEnumerated(index: Integer; out type_: Integer; out value: Integer);
procedure PutEnumerated(type_: Integer; value: Integer);
procedure GetReference(index: Integer; out value: IActionReference);
procedure PutReference(const value: IActionReference);
procedure GetClass(index: Integer; out value: Integer);
procedure PutClass(value: Integer);
procedure GetGlobalClass(index: Integer; out value: Integer);
procedure PutGlobalClass(value: Integer);
procedure GetPath(index: Integer; out pathString: WideString);
procedure PutPath(const pathString: WideString);

Back to top

--------------------------------------------------------------------------------

IActionReference - methods
procedure GetForm(out value: Integer);
procedure GetDesiredClass(out value: Integer);
procedure PutClass(desiredClass: Integer);
procedure GetName(out name: WideString);
procedure PutName(desiredClass: Integer; const name: WideString);
procedure GetIndex(out value: Integer);
procedure PutIndex(desiredClass: Integer; value: Integer);
procedure GetIdentifier(out value: Integer);
procedure PutIdentifier(desiredClass: Integer; value: Integer);
procedure GetOffset(out value: Integer);
procedure PutOffset(desiredClass: Integer; value: Integer);
procedure GetEnumerated(out type_: Integer; out enumValue: Integer);
procedure PutEnumerated(desiredClass: Integer; type_: Integer; value: Integer);
procedure GetProperty(out value: Integer);
procedure PutProperty(desiredClass: Integer; value: Integer);
procedure GetContainer(out value: IActionReference);

Back to top

--------------------------------------------------------------------------------

How do I ... ?
Start Photoshop
Close Photoshop
Open a file
Save a file
Play an action
Back to top

--------------------------------------------------------------------------------

>>>>>How to start PhotoShop<<<<<
uses ComObj, ActiveX, PhotoShopTypeLibrary_TLB;

var
PS: IPhotoShopApplication;
AppWasRunning: boolean;
Unknown: IUnknown;
begin
AppWasRunning := False;
Result := GetActiveObject(CLASS_PhotoshopApplication, nil, Unknown);
if (Result = MK_E_UNAVAILABLE) then
PS := CoPhotoshopApplication.Create
else begin
{ make sure no other error occurred during GetActiveObject }
OleCheck(Result);
OleCheck(Unknown.QueryInterface(IPhotoShopApplication, PS));
AppWasRunning := True;
end;
PS.Visible := True;

Or, with late binding:

PS := CreateOleObject('Photoshop.Application');
PS.Visible := True;

Back to 'HowDoI'

--------------------------------------------------------------------------------

>>>>>How to close Photoshop<<<<<
If PS is your Photoshop application variable:

PS.Quit;
Back to 'HowDoI'

--------------------------------------------------------------------------------

>>>>>How to open a file<<<<<
If PS is your Photoshop application variable:

var
Pic: IAutoPSDoc;
begin
Pic := PS.Open('InsertNameHere.psd'); // Bingeley-bingeley-beep!

Back to 'HowDoI'

--------------------------------------------------------------------------------

>>>>>How to save a file<<<<<
If Pic is your IAutoPSDoc variable:

Pic.SaveTo('InsertNameHere.psd');

Back to 'HowDoI'

--------------------------------------------------------------------------------

>>>>>How to play an action<<<<<
If PS is your Photoshop application variable:

PS.PlayAction('Large Round Button');

 
CJ的主意只能适合中国国情,国外很少有人用photoshop的,因为买不起.

我知道一个控件可以支持PSD格式,但是现在像不起来下载地质了,明天
到公司照照看.
 
那有这方面的控件
 
我已上载到我的主页....不过我没有测试他是否真的支持PSD格式,作者是这么说的.
 
用ACD See更简单:用ACD See将图片打开—>双击图片使其在ACD See Browser状态下,然后Ctrl+F,调出Format conversion对图片进行修改—>选择所要更改类型然后回车。That's all.
 
多人接受答案了。
 
后退
顶部