Write tif file color table
Hello:
I am trying to write a 16-bit tif file with the proper color table using Vision utility. I cannot get the proper color table. I can save as other formats but have special requests for 16-bit tif.
I have attached an example VI to show you this including a test color table and image. I will cross post in the Vision forum also. Any help is appreciated.
Sincerely,
Don
Attachments:
test_write_tiff.vi 56 KB
normalize_2darray_data_for_16-bit_scanner.vi 13 KB
Identical post in machine vision message board: write tif file color table
Hope this helps.
-Ben
WaterlooLabs
Similar Messages
-
I want to read tif file and encrypt it by aes. who can help me?
I have several questions:
1. Is there a java api to read and write tif files. this api can read the header of tif(IFH) and add something into the header.
2. Is there a java api to encypt the stream of tif file by AES?
Thanks a lot!!! every superman comes here and helps me.
Thank u1. Is there a java api to read and write tif files. this api can read the header of tif(IFH) and add something into the header.javax.imageio.ImageIO
2. Is there a java api to encypt the stream of tif file by AES?javax.crypto.CipherOutputStream -
How can create color table for "write bmp file.vi"?
i want to create a color table for a 8 bit bitmap.The color table is the input of "write bmp file.vi". how can i make it?
thanks!> i want to create a color table for a 8 bit bitmap.The color table is
> the input of "write bmp file.vi". how can i make it?
> thanks!
>
There is a color control on the front panel numerics palette. A color
in LV is a four byte xRGB formatted number. So you can make an array of
the color numerics and set them by hand or format the numbers however
you like. If unwired it will use the LV color palette which is pretty
much the HTML palette.
Greg McKaskle -
How to load color table in a indexed mode file??
How to load color table in a indexed mode file??
Actually, if i opened a indexed file and want to edit color table by loading another color table from desktop (or any other location), any way to do this through java scripting??continuing...
I wrote a script to read a color table from a GIF file and save to an ACT color table file. I think it might be useful for someone.
It goes a little more deeper than the code I posted before, as it now identifies the table size. It is important because it tells how much data to read.
Some gif files, even if they are saved with a reduced palette (less than 256), they have all the bytes for the full color palette filled inside the file (sometimes with 0x000000). But, some gif files exported in PS via "save for web" for example, have the color table reduced to optimize file size.
The script store all colors into an array, allowing some kind of sorting, or processing at will.
It uses the xlib/Stream.js in xtools from Xbytor
Here is the code:
// reads the color table from a GIF image
// saves to an ACT color table file format
#include "xtools/xlib/Stream.js"
// read the 0xA byte in hex format from the gif file
// this byte has the color table size info at it's 3 last bits
Stream.readByteHex = function(s) {
function hexDigit(d) {
if (d < 10) return d.toString();
d -= 10;
return String.fromCharCode('A'.charCodeAt(0) + d);
var str = '';
s = s.toString();
var ch = s.charCodeAt(0xA);
str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
return str;
// hex to bin conversion
Math.base = function(n, to, from) {
return parseInt(n, from || 10).toString(to);
//load test image
var img = Stream.readFromFile("~/file.gif");
hex = Stream.readByteHex(img); // hex string of the 0xA byte
bin = Math.base(hex,2,16); // binary string of the 0xA byte
tableSize = bin.slice(5,8) // Get the 3 bit info that defines size of the ct
switch(tableSize)
case '000': // 6 bytes table
tablSize = 2
break;
case '001': // 12 bytes table
tablSize = 4
break;
case '010': // 24 bytes table
tablSize = 8
break;
case '011': // 48 bytes table
tablSize = 16
break;
case '100': // 96 bytes table
tablSize = 32
break;
case '101': // 192 bytes table
tablSize = 64
break;
case '110': // 384 bytes table
tablSize = 128
break;
case '111': // 768 bytes table
tablSize = 256
break;
//========================================================
// read a color (triplet) from the color lookup table
// of a GIF image file | return 3 Bytes Hex String
Stream.getTbColor = function(s, color) {
function hexDigit(d) {
if (d < 10) return d.toString();
d -= 10;
return String.fromCharCode('A'.charCodeAt(0) + d);
var tbStart = 0xD; // Start of the color table byte location
var colStrSz = 3; // Constant -> RGB
var str = '';
s = s.toString();
for (var i = tbStart+(colStrSz*color); i < tbStart+(colStrSz*color)+colStrSz; i++) {
var ch = s.charCodeAt(i);
str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
return str;
var colorHex = [];
importColors = function (){
for (i=0; i< tablSize; i++){ // number of colors
colorHex[i] = Stream.getTbColor(img, i);
importColors();
// remove redundant colors
// important to determine exact color number
function unique(arrayName){
var newArray=new Array();
label:for(var i=0; i<arrayName.length;i++ ){
for(var j=0; j<newArray.length;j++ ){
if(newArray[j]==arrayName[i])
continue label;
newArray[newArray.length] = arrayName[i];
return newArray;
colorHex = unique(colorHex);
// we have now an array with all colors from the table in hex format
// it can be sorted if you want to have some ordering to the exported file
// in case, add code here.
var colorStr = colorHex.join('');
//=================================================================
// Output to ACT => color triplets in hex format until 256 (Adr. dec 767)
// if palette has less than 256 colors, is necessary to add the
// number of colors info in decimal format to the the byte 768.
ColorNum = colorStr.length/6;
lstclr = colorStr.slice(-6); // get last color
if (ColorNum < 10){
ColorNum = '0'+ ColorNum;
cConv = function (s){
var opt = '';
var str = '';
for (i=0; i < s.length ; i++){
for (j=0; j<2 ; j++){
var ch = s.charAt(i+j);
str += ch;
i ++;
opt += String.fromCharCode(parseInt(str,16));
str = '';
return opt
output = cConv(colorStr);
// add ending file info for tables with less than 256 colors
if (ColorNum < 256){
emptyColors = ((768-(colorStr.length/2))/3);
lstclr = cConv(lstclr);
for (i=0; i < emptyColors ; i++){
output += lstclr; // fill 256 colors
output += String.fromCharCode(ColorNum) +'\xFF\xFF'; // add ending bytes
Stream.writeToFile("~/file.act", output);
PeterGun -
IMAQ Write JPEG File doesn't save color
Hi, I'm writing an 8 bit image to file. If I save it as bmp (using "IMAQ Write BMP.vi") File then color data is saved. If I save it as Jpeg using "IMAQ Write JPEG File", then I only get grayscale. I have attached a demonstration. There appears to be a bug in the IMAQ vi.
Attachments:
ni_demo.llb 203 KBAt IMAQ create.vi you need to specify RGB image type. You are actually using 8 bit, that is a grayscale type.
Attachments:
ni_demo.llb 203 KB -
When it is in pdf, the colors look/print the way I want, but when it is in tif they change. How do I fix this?
You have not provided any proper technical details like what version of AI, what system, how you review your files, color management, export settings. Chances are you are trying to view CMYK files in an RGB viewer, but beyond that we can't really know anything...
Mylenium -
"Bitmap file: No color table available (True Color, Bitcount 32)"
When I tried to import a bitmap file into SAP R3 by using T code SE78 -> Graphics->BMAP, I got an error message "Bitmap file: No color table available (True Color, Bitcount 32)".
How can I fix this?
Thanks in advance!
Fisher LiI followed the answer here and it did not work for me
I used freware called GIMP to save the image as 24 bit (after choosing the file name at save, you get to set this in the advanced options). This worked.
I tried rescaling the image to be smaller and this made no impact on my ability to load the image. -
How can I create a black and white table for Write BMP File.vi?
I just want to create a black and white array to create the picture in B'n W
You can use this VI, which outputs an 8-bit Greyscale Color Table.
Good luck,
Jim
Attachments:
8-bit_Greyscale_Color_Table.vi 11 KB -
How do I color a grayscale TIF file?
I remember it being easy to do in Quark... But now I can't get it done in ID (CS6).... The TIF file is not transparent (all layers flattened).
I tried searching, but still don't have an answer....
Thanks.......OOooPppppppSSsssss, sorry, it was a grayscale, but somehow the mode was left as CMYK... All is good now, thanks!
-
Lightroom and DxO: fix lens flaws in a TIF file exported from LR
Hi,
I'm in love with LR, I don't mind if people tell me that other Raw converter do a better job in demosaicing. Anyway some time ago a friend told me about DxO Optics Pro, I tried and loved the lens corrections. I thought I could prform those correction at the end of my workflow on a Tiff file exported from LR to DxO. No way! It seems that DxO doesn't recognize the lens used to shoot the image. It seems that LR and Camera Raw delete all the infos related to optics used. Any help would be appreciated.
Bye!I used the following command to swap exif data:
exiftool -all= -tagsfromfile DSC_0002.NEF -exif:all DSC_0009-2.tif
The TIF file contais less exif tags than the NEF (or DNG) file, and there is no tag about the lens used.
Here's what I get copying exif data from one file to another:
ExifTool Version Number : 7.70
File Name : DSC_0002.NEF
Directory : .
File Size : 5.7 MB
File Modification Date/Time : 2009:02:25 13:44:44+01:00
File Type : NEF
MIME Type : image/x-raw
Exif Byte Order : Big-endian (Motorola, MM)
Make : NIKON CORPORATION
Camera Model Name : NIKON D70s
Software : Ver.1.00
Modify Date : 2009:02:25 13:44:42
Jpg From Raw Start : 131072
Jpg From Raw Length : 725092
Y Cb Cr Positioning : Co-sited
Subfile Type : Full-resolution Image
Image Width : 3040
Image Height : 2014
Bits Per Sample : 12
Compression : Nikon NEF Compressed
Photometric Interpretation : Color Filter Array
Strip Offsets : 856404
Orientation : Rotate 270 CW
Samples Per Pixel : 1
Rows Per Strip : 2014
Strip Byte Counts : 5095416
X Resolution : 300
Y Resolution : 300
Planar Configuration : Chunky
Resolution Unit : inches
CFA Repeat Pattern Dim : 2 2
CFA Pattern 2 : 2 1 1 0
Reference Black White : 0 255 0 255 0 255
Exposure Time : 1/50
F Number : 4.0
Exposure Program : Manual
Create Date : 2009:02:25 13:44:42
Exposure Compensation : 0
Max Aperture Value : 3.5
Metering Mode : Center-weighted average
Flash : No Flash
Focal Length : 18.0 mm
Maker Note Version : 2.10
ISO : 800
Quality : Raw
White Balance : Auto
Focus Mode : AF-S
Flash Setting : Normal
Flash Type :
White Balance Fine Tune : 0
Program Shift : 0
Exposure Difference : +1.8
Preview Image Start : 8112
Preview Image Length : 24932
Flash Exposure Compensation : 0
ISO Setting : 800
Flash Exposure Bracket Value : 0.0
Exposure Bracket Value : 0
Tone Comp : Normal
Lens Type : G
Lens : 18-70mm f/3.5-4.5
Flash Mode : Did Not Fire
AF Area Mode : Single Area
AF Point : Center
AF Points In Focus : Center
Shooting Mode : Single-Frame
Contrast Curve : (Binary data 4160 bytes, use -b option to extract)
Color Hue : Mode1a
Light Source : Natural
Hue Adjustment : 0
NEF Compression : Lossy (type 1)
Noise Reduction : Off
Linearization Table : (Binary data 1412 bytes, use -b option to extract)
WB RGBG Levels : 555 256 388 256
Lens Data Version : 0101
Exit Pupil Position : 102.4 mm
AF Aperture : 3.6
Focus Position : 0x01
Focus Distance : 3.98 m
Lens ID Number : 127
Lens F Stops : 5.33
Min Focal Length : 18.3 mm
Max Focal Length : 71.3 mm
Max Aperture At Min Focal : 3.6
Max Aperture At Max Focal : 4.5
MCU Version : 132
Effective Max Aperture : 3.6
Raw Image Center : 1520 1008
Sensor Pixel Size : 7.8 x 7.8 um
Serial Number : No= 3005d534
Shutter Count : 31244
Flash Info Version : 0100
Flash Model : (none)
External Flash Flags : (none)
Flash Commander Mode : Off
Flash Control Mode : Off
Flash Group A Control Mode : Off
Flash Group B Control Mode : Off
Flash Group A Exposure Comp : 0
Flash Group B Exposure Comp : 0
Image Optimization : Custom
Vari Program :
User Comment :
Sub Sec Time : 20
Sub Sec Time Original : 20
Sub Sec Time Digitized : 20
Sensing Method : One-chip color area
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Manual
Digital Zoom Ratio : 1
Focal Length In 35mm Format : 27 mm
Scene Capture Type : Standard
Gain Control : Low gain up
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Subject Distance Range : Unknown
Date/Time Original : 2009:02:25 13:44:42
TIFF-EP Standard ID : 1 0 0 0
Aperture : 4.0
Blue Balance : 1.515625
CFA Pattern : [Blue,Green][Green,Red]
Image Size : 3040x2014
Jpg From Raw : (Binary data 725092 bytes, use -b option to extract)
Lens ID : AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED
Lens : 18-70mm f/3.5-4.5 G
Preview Image : (Binary data 24932 bytes, use -b option to extract)
Red Balance : 2.167969
Scale Factor To 35 mm Equivalent: 1.5
Shutter Speed : 1/50
Create Date : 2009:02:25 13:44:42.20
Date/Time Original : 2009:02:25 13:44:42.20
Modify Date : 2009:02:25 13:44:42.20
Circle Of Confusion : 0.020 mm
Depth Of Field : 197.49 m (2.01 - 199.50)
Field Of View : 67.1 deg (5.28 m)
Focal Length : 18.0 mm (35 mm equivalent: 27.0 mm)
Hyperfocal Distance : 4.04 m
Light Value : 6.6 -
Multiple attachments (TIF-files) in Emails
hi all,
I'm trying to send an eMail with multiple attachments (TIF-files) with the function SO_NEW_DOCUMENT_ATT_SEND_API1.
The eMail with the attachments arrives well. The problem is, when opening the attachments all look the same as the 1. attachment. The archived TIFFs are not the same and I can see that the arrived attachments have different file-lenghts.
The packing list looks like:
HEAD_START HEAD_NUM BODY_START BODY_NUM
1 1 1 57
1 1 58 198
1 1 199 415
The table-length of the first object is 57, the second object 141, the third 217.
The contents_bin table has 415 lines. I appended all object-tables to the contents_bin table.
Is there something which I have to consider especially?
Thanks and regards
OliverI had to write something similar for text files, so this may or may not be a useful tip. BODY_NUM represents the length of the text, i.e. the number of lines not the final line number. So the packing list should be
1 1 1 57
1 1 58 141
1 1 199 217
Hope this helps...although probably very out of date by now...
D. -
Hello,
I am developing a format plug-in to save out the color table for a document. In the documentation I am having trouble finding how I can access the document's palette. Where can I find this info? Would this work better as a export plug-in? Thank you for your time.A file format expects to write out the image.
An export plugin could export almost anything (color table, statistics, etc.).
Either one has access to the color table for indexed color images. -
Read PDF Formatted Spool and write PDF File to Application Server
Hi Experts,
After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
PARAMETERS : p_spono LIKE tsp01-rqident.
DATA: pdf_data type FPCONTENT.
types: lt_pdf_table(1000) type x.
data: l_pdf_data type standard table of lt_pdf_table,
l_pdf_line type lt_pdf_table,
l_offset type i,
l_len type i,
p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
*Read the spool content
CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
EXPORTING
i_spoolid = p_spono
i_partnum = '1'
IMPORTING
e_pdf = pdf_data
* e_pdf_file = file
EXCEPTIONS
ads_error = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
* Modify the spool contents to prepare internal table
l_len = xstrlen( pdf_data ).
while l_len >= 1000.
l_pdf_line = pdf_data+l_offset(1000).
append l_pdf_line to l_pdf_data.
add 1000 to l_offset.
subtract 1000 from l_len.
endwhile.
if l_len > 0.
l_pdf_line = pdf_data+l_offset(l_len).
append l_pdf_line to l_pdf_data.
endif.
* GUI DOWNLOAD Works Fine
* Now pdf contents is ready , lets store in local PC
*CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* filename = 'C:\Documents and Settings\Desktop\shital.pdf'
* filetype = 'BIN'
* TABLES
* data_tab = l_pdf_data.
OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error opening file:'(Z03) p_file.
ENDIF.
LOOP AT l_pdf_data INTO l_pdf_line.
TRANSFER l_pdf_line TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error closing file:'(Z04) p_file.
ENDIF.
Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
Let me know if you require further details about the issue.
Regards
Shital
Edited by: shital phadake on Apr 8, 2009 9:39 PMThanks Selçuk for your reply and taking time for understanding the Issue,
I went thru Functionality of the program you suggested but dont think it matches my requirement.
Regards
Shital -
How to load Color Table in VB?
Hi, I'm very new to Illustrator scripting and this problem drives me crazy. I can't find any information on the Web, so please help~!
I have a series of illustrator files(.ai) and a color table(.act), and I wanna apply the same color table to all these image files. I know how to do it in Illustrator: open the ai file, "save for web" then load the color table in by click the color palette button, then click on "done". But how can I do this in VB? anyone have any idea?
Your help is highly appreciated!
Cheers,any idea? I really need help~
-
Exporting photos for UHDTV or Native 4K TV, what are the best settings ? (File: Quality File: Color Space, Image Sizing and resolution) Or in other words; How can I get the smallest files but keep good quality for display on new UHDTV
You're welcome, and thank you for the reply.
2) Yesterday I made the subclips with the In-Out Points and Command-U, the benefit is that I've seen the clip before naming it. Now I'm using markers, it's benefit is that I can write comment and (the later) clip name at once, the drawback is that I have to view to the next shot's beginning before knowing what the shot contains.
But now I found out that I can reconnect my clips independently to the format I converted the master clip to. I reconnected the media to the original AVI file and it worked, too! The more I work with, the more I'm sold on it... - although it doesn't seem to be able to read and use the date information within the DV AVI.
1) Ok, I tried something similar within FCE. Just worked, but the file size still remains. Which codec settings should I use? Is the export to DV in MOV with a quality of 75% acceptable for both file size and quality? Or would be encoding as H.264 with best quality an option for archiving, knowing that I have to convert it back to DV if I (maybe) wan't to use it for editing later? Or anything else?
Thank's in advance again,
André
Maybe you are looking for
-
How to suppress a Security Notifcation for all users
How can we suppress the notification If you open this document, anonymous usage data will be sent securely to this remote server: To learn more about what this means for you, please click on the 'Privacy and Security' button. check box - Allow collec
-
How to Add two numbers using RFC in WD abap
Dear Experts, I have to add the two numbers using RFC. I have created the RFC and by using create -> service call i have include that RFC in my WD abap Program.. After that i don't know how to link the input view and to display the result in another
-
Once u set up a password on the listener, how do you code it exactly on the listener utility to start a listener with a password? lsnrctl: start listener password I tried above, it doesn't work. (vs. 9i)
-
MSI CX623 shut down automatically
I have a notebook MSI cx623 with next configuration: Intel Core I3 390m 2.66Ghz, 4GB RAM, video dedicated Nvidia Geforce 310m 1GB and HDD WD 320 GB And I have next problem: this shut down automatically without any warning and if i want to start back
-
Migrating from 2007 Mac Book running 10.4.11 to new Mac Book Pro
Applecare is about to expire on my trusty 13" MacBook. I have been reading these forums to help me decide on a new laptop and will probably get a 13" MacBook Pro since I only do e-mail, internet and some home video editing with iDVD but want somethin