Tif image loader
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Tif image loader
Plugin to load tif format image files into workspace. Loads both compressed and uncompressed tif files. Based on the tifflib code, tiff library and utilities.
http://clintons3d.com/plugins/truespace ... tiffloader
http://clintons3d.com/plugins/truespace ... tiffloader
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Can this Tiff Loader be updated to use your plugin Open dialog with TIF as the only choice?
. .
The Tif Loader.RsObj has a Filename attribute
Not sure how to remove All Files and populate the Filename attribute with the returned path
Removed due to update
. .
Code: Select all
var fso = new ActiveXObject("Scripting.FileSystemObject");
var util = System.CreateDO("Clintons3D Package/Utility functions");
var folder = "";
var filename = "";
folder = fso.GetParentFolderName(filename);
filename = fso.GetFileName(filename);
//fso method return of folder or filename is flawed when path is invalid/empty
//causes returned value of plugin to cause tS crash
if(folder=="") folder="";
if(filename=="") filename="";
//var defExt = "tga";
//var filter = "TGA (*.tga)~*.tga~EXR (*.exr)~*.exr~HDR (*.hdr)~*.hdr~Jpeg (*.jpg)~*.jpg~PNG (*.png)~*.png~TIF (*.tif)~*.tif~All Files (*.*)~*.*~~";
var defExt = "TIF";
var filter = "TIF (*.tif)~*.tif~All Files (*.*)~*.*~~";
var file = util.FileOpenDialog(folder, filename, filter, defExt);
Not sure how to remove All Files and populate the Filename attribute with the returned path
Removed due to update
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
New button added.
The way you wrote the popup you are limited to 1 tiff file in the scene, so if you want more than 1 you have to rename the node before loading another one.
The way you wrote the popup you are limited to 1 tiff file in the scene, so if you want more than 1 you have to rename the node before loading another one.
- Attachments
-
- Tiff Loadere3f0.RsObj
- (57.62 KiB) Downloaded 124 times
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Thank you!
I tried removing the popup's Node.Delete, but I find, since multiple copies share the one Panel Frame, there is multiple copies left over in the scene
Do you have a better suggestion?
Couldn't a user Load and Save images from the same panel?
I tried using your plugin's Save As Dialog (v2) for trueSpace, but failed miserably!
Removed due to update
I tried removing the popup's Node.Delete, but I find, since multiple copies share the one Panel Frame, there is multiple copies left over in the scene
Do you have a better suggestion?
Couldn't a user Load and Save images from the same panel?
I tried using your plugin's Save As Dialog (v2) for trueSpace, but failed miserably!
Removed due to update
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
I don't know how you're planning to use it, so no I don't have any suggestions. Don't even know why it's a popup.
Save as images has limited file formats, bmp, dds, hdr, jpg, png, dib, pfm.
Attached has working Save as Dialog(v2)
Save as images has limited file formats, bmp, dds, hdr, jpg, png, dib, pfm.
Attached has working Save as Dialog(v2)
- Attachments
-
- Tiff Loaderb3aa.RsObj
- (58.29 KiB) Downloaded 139 times
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Thanks againclintonman wrote: 23 Apr 2022, 22:24 I don't know how you're planning to use it, so no I don't have any suggestions.
Don't even know why it's a popup.
The popup is for users that have Link Editor phobia
I take it, that you use it for importing and linking tif images to other bitmaps in the Link Editor?
That is still possible
There was an issue when switching to png in the dialog, it would not switch to png
Also, the File name: in the dialog was the name of the imported tif
IE: File name: MyImage.tif
When you save it that way, even though the dialog's Save as type: was bmp, the file saved is not good
So I added one line:
filename = "Image"
Here is the changes:
Code: Select all
var Filename = Node.Value("%THIS_NAME%", "Filename")
if(Filename == "") {return;}
var fso = new ActiveXObject("Scripting.FileSystemObject");
var util = System.CreateDO("Clintons3D Package/Utility functions");
var folder = "";
var filename = Node.Value("%THIS_NAME%", "Filename");
var defExt = "bmp";
var filter = "BMP (*.bmp)~*.bmp~DDS (*.dds)~*.dds~HDR (*.hdr)~*.hdr~Jpeg (*.jpg)~*.jpg~PNG (*.png)~*.png~";
filename = "Image"
var file = util.FileSaveAsDialog2(folder, filename, filter, defExt);
if(file) Library2.DlgGenericSave(file, "%THIS_NAME%/Image", 3);
One thing to note is I omitted one Tilda ( ~ ) at the end
.
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
From the original Save As Dialog, uses "~" as a delimiter between the description and the extension and end the string with 2 ~'s
So removing the extra ~ maybe it's ok or maybe it create problems later. I wouldn't take the chance.
It would be simpler to change the line
var filename = Node.Value("%THIS_NAME%", "Filename");
to
var filename = "";
or
var filename = "Image";
So removing the extra ~ maybe it's ok or maybe it create problems later. I wouldn't take the chance.
It would be simpler to change the line
var filename = Node.Value("%THIS_NAME%", "Filename");
to
var filename = "";
or
var filename = "Image";
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Thanks, I added the extra ~
One way I was using your TIF Loader is in YafaRay4tS as a TIF Viewer
One way I was using your TIF Loader is in YafaRay4tS as a TIF Viewer
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Just noticed that this does not show/open tiff images only tif
Edit: I fixed it
var filter = "TIF (*.tif)~*.tif~TIFF (*.tiff)~*.tiff~~";
Is the a way to show/open both in the File type
Edit: I fixed it
var filter = "TIF (*.tif)~*.tif~TIFF (*.tiff)~*.tiff~~";
Is the a way to show/open both in the File type
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
Good question. Had to look it up. You use semicolon to list themtrueBlue wrote: 26 Apr 2022, 00:23 Just noticed that this does not show/open tiff images only tif
Edit: I fixed it
var filter = "TIF (*.tif)~*.tif~TIFF (*.tiff)~*.tiff~~";
Is the a way to show/open both in the File type![]()
var filter = "TIF (*.tif;*.tiff)~*.tif;*.tiff~~";
the first half is displayed and can be anything you want - "TIF (*.tif;*.tiff)"
second half is the actual filter "*.tif;*.tiff"
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
Update October 2024
added support for EXR files to the plugin.
I found that tS HDR image save is not high quality. It gives a wider range of colors but seems to keep discrete step values like an LDR image. It's strange and difficult to explain, maybe it's rounding the values?. This EXR save command keeps the quality of the color values of the image. The only real way to see the difference is to save a HDR format smooth image and compare it to the EXR image and see how the values jump in the HDR compared to the EXR image.
The EXR loader was tested with images from here:
https://openexr.com/en/latest/test_images/index.html
The loader does not support the pxr24 or b44 compression
When saving an exr with alpha channel it won't load back into tS properly. The color channels get scrambled. The really weird thing is if you open the image in another app it looks just fine. So if you load an exr image with alpha it looks good. Then you save it with alpha it looks bad in tS but identical to the original in other programs. There is a checkbox to unscramble the colors when using the loader.
EXR Loader nodes
https://clintons3d.com/plugins/truespac ... tiffloader
updated rsx plugin
https://clintons3d.com/plugins/truespac ... dPluginExt
added support for EXR files to the plugin.
I found that tS HDR image save is not high quality. It gives a wider range of colors but seems to keep discrete step values like an LDR image. It's strange and difficult to explain, maybe it's rounding the values?. This EXR save command keeps the quality of the color values of the image. The only real way to see the difference is to save a HDR format smooth image and compare it to the EXR image and see how the values jump in the HDR compared to the EXR image.
The EXR loader was tested with images from here:
https://openexr.com/en/latest/test_images/index.html
The loader does not support the pxr24 or b44 compression
When saving an exr with alpha channel it won't load back into tS properly. The color channels get scrambled. The really weird thing is if you open the image in another app it looks just fine. So if you load an exr image with alpha it looks good. Then you save it with alpha it looks bad in tS but identical to the original in other programs. There is a checkbox to unscramble the colors when using the loader.
EXR Loader nodes
https://clintons3d.com/plugins/truespac ... tiffloader
updated rsx plugin
https://clintons3d.com/plugins/truespac ... dPluginExt
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Tif image loader
Can you help with the Save As button code?
And anything else you see that maybe wrong.
And anything else you see that maybe wrong.
- Attachments
-
- Exr Loader.RsObj
- (63.79 KiB) Downloaded 32 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
Removed the image node
Connected internal Exr Loader Bitmap to the Image Information
Save As button saves %THIS_NAME%
This also reminds me that I forgot to add the loaded filename into the Bitmap data, so one more rsx change coming...
Connected internal Exr Loader Bitmap to the Image Information
Save As button saves %THIS_NAME%
This also reminds me that I forgot to add the loaded filename into the Bitmap data, so one more rsx change coming...
- Attachments
-
- Exr Loaderc625.RsObj
- (62.6 KiB) Downloaded 32 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
I updated the rsx plugin to version 1638417
The only change is that the filename of the image will display when running the script command that reads it.
SDK docs:
HRESULT IRdBitmapDisp::GetFileName ( [out, retval] BSTR * pFileName )
The only change is that the filename of the image will display when running the script command that reads it.
SDK docs:
HRESULT IRdBitmapDisp::GetFileName ( [out, retval] BSTR * pFileName )
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Tif image loader
I just found out the EXR Loader isn't needed. tS will load exr files just fine. It just wont save exr files.



