Tif image loader
- clintonman
- Captain
- Posts: 5595
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
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.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: 5595
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
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 Loader.RsObj
- (57.62 KiB) Downloaded 106 times
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: 5595
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
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 Loader.RsObj
- (58.29 KiB) Downloaded 120 times
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: 5595
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
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";
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
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: 5595
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: Tif image loader
Good question. Had to look it up. You use semicolon to list them
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"