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

Need to support a new image format with .JPG extension

Explorer ,
Jan 11, 2010 Jan 11, 2010

Copy link to clipboard

Copied

Hello,

For some reasons out of my control, I need to read/write a brand new custom image format from Photoshop with ".jpg" file extension. I already wrote a format plugin that supports this new image format with its own file extension (say ".ext") and it works fine. However, sometimes, the new files will have .JPG extension on disk and I would like Photoshop to call my plugin to load these files instead of using the default jpg plugin.

Ideally, here is what I would like to do:

  1. A file with .jpg extension exists on disk. The file could be of my new format or in standard JPG format.
  2. I try to load it with Photoshop and my new plugin gets called first and determines if it is standard JPEG or not. There are 2 cases:
    • the file is a regular JPEG: my plugin refuses to load and photoshop loads it from it default JPEG plugin
    • the file is in my new format: my plugin accepts to load it as a .ext file

Basically, (1) can I override the default JPG plugin with my own plugin while loading an image and (2) can I transfer the loading of that image to the default JPEG plugin if I realize that it is indeed a regular JPEG?

What is the best way to do that? Do I need to write another type of plugin (maybe a filter??) ?

Thank you!

Gilbert

TOPICS
SDK

Views

1.2K

Translate

Translate

Report

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
Jan 11, 2010 Jan 11, 2010

Copy link to clipboard

Copied

For JPEG/JPG you have to override the support built into Photoshop.

That means you have to change the priority value so your format will run before ACR and Photoshop itself.

1) yes, clearly explained in the SDK

2) yes, clearly explained in the SDK

(Why do I know it's clear? Because I wrote the same sort of JPEG override format plugin 15 years ago.)

Votes

Translate

Translate

Report

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
Contributor ,
Jan 11, 2010 Jan 11, 2010

Copy link to clipboard

Copied

Just as Chris said, its very much doable and we went through a similar process very recently. You may want to check this post ( http://forums.adobe.com/thread/359900? ) that deals with one quirky issue that popped up during the development.

Votes

Translate

Translate

Report

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
Explorer ,
Jan 11, 2010 Jan 11, 2010

Copy link to clipboard

Copied

Thank you. I get the big picture:

  1. I must change the priority of my plugin to be called before the default JPEG plugin.
  2. I must enable the FilterSelector to test the file and reject it when it is a regular JPEG.

To change the priority, I added this line to my resource:

     Priority { 0 },

(lower number will be loaded first according to the doc).

Only problem is that I have a hard time to activate the Filter event. I tried the sample simpleFormat CS4 plugin out of the SDK box and the Filter event is not triggered.

The resource for the simpleFormat plugin are

FmtFileType { 'SME ', '8BIM' },

//ReadTypes { { '8B1F', '    ' } },

FilteredTypes { { '8B1F', '    ' } },

ReadExtensions { { 'SME ' } },

WriteExtensions { { 'SME ' } },

FilteredExtensions { { 'SME ' } },

How can I get the Filter event before I get the ReadPrepare event ?

The only way I got the filter event is when I tried:

Priority { -1000 },

FmtFileType { 'SME ', '8BIM' },

//ReadTypes { { '8B1F', '    ' } },

FilteredTypes { { '    ', '    ' } },

ReadExtensions { { 'JPG ', 'SME ' } },

WriteExtensions { { 'SME ' } },

FilteredExtensions { { 'JPG ', 'SME ' } },

(i.e. using 4 spaces in the Filtered Types).

However, even with priority -1000, my plugin is still not called for a .JPG  file to filter the file and reject it.

Thank you!

Gilbert

Votes

Translate

Translate

Report

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
Explorer ,
Jan 12, 2010 Jan 12, 2010

Copy link to clipboard

Copied

Ok, I finally got everything to work as I wanted with these PiPL resources (note that my new extension and file format is MW):

FmtFileType { 'MW  ', '8BIM' },

//ReadTypes { { '8B1F', '    ' } },

FilteredTypes { { 'MW  ', '    '}},

ReadExtensions { {'MW  ' } },

WriteExtensions { { 'MW  ' } },

FilteredExtensions { { 'JPG ', 'MW  ' } },

I dont actually need to play with the priority apparently. My plugin gets called for a MW (my new format) with .jpg or with a .mw extension and I can read it fine. When it is a regular JPG file, I filter it and return 'formatCannotRead' from the  formatSelectorFilterFile   event  and Photoshop takes over the reading of that file.

Thanks for your help!

Gilbert

Votes

Translate

Translate

Report

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
Explorer ,
Mar 11, 2010 Mar 11, 2010

Copy link to clipboard

Copied

This is a relatively old posting but i have a new question on the same topic.

I have a new format plugin that supports 2 extensions: 'MW' and 'JPG' (i.e. the MW files can sometimes have .JPG extensions ). Using the

    FilteredExtensions { { 'JPG ', 'MW  ' } },

in the PiPL resource works nicely to redirect the  .JPG files to my plugin to validate the header (I can then reject them or read them if they happen to be MW files).

Q: when a MW file with .JPG extension is loaded, if you do 'Save As', photoshop will propose the orginal filename with .MW extension (although the orignal name had .JPG extension). Is there a way to configure the plugin so that the original file name will be preserved (with its original JPG extension) even though it will be saved in MW format ? Of course I can simply replace manually the extension but a few users would prefer to not have to do that.

Thank you!

Gilbert

Votes

Translate

Translate

Report

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
Mar 11, 2010 Mar 11, 2010

Copy link to clipboard

Copied

LATEST

No.  If you read multiple extensions, Photoshop will still only use the primary file extension for the format when saving.

(it's an MW format, or it's a JPEG format...  it really shouldn't be both)

Votes

Translate

Translate

Report

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