[Image->Scale] Tag inverting images.

2 views
Skip to first unread message

Israel Thompson

unread,
Jun 27, 2007, 4:08:50 PM6/27/07
to Lasso Talk
Hello all,

I've noticed a strange oddity with some of my images when using the
Image->Scale tag. For some reason when I select the -Thumbnail attribute my
image gets inverted (like a film negative where light and dark are
opposites). When I use -Sample it doesn't happen, but the image's edges
aren't as smooth.

Anyone else run across this? And is there a fix or alternative?

Thanks,

Sincerely,

Israel


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Fletcher Sandbeck

unread,
Jun 27, 2007, 4:12:23 PM6/27/07
to Lasso Talk
On 6/27/07 at 3:08 PM, thompso...@gmail.com (Israel
Thompson) wrote:

>I've noticed a strange oddity with some of my images when using the
>Image->Scale tag. For some reason when I select the -Thumbnail attribute my
>image gets inverted (like a film negative where light and dark are
>opposites). When I use -Sample it doesn't happen, but the image's edges
>aren't as smooth.
>
>Anyone else run across this? And is there a fix or alternative?

I haven't seen anything like that. Please send one of the
problem images and the code you are using to
<bu...@lassosoft.com> and we will look into it. Also, if you
could mention what version of Lasso you are using and on what
platform it is running.

[fletcher]

--
Fletcher Sandbeck flet...@lassosoft.com
LassoSoft, LLC http://www.lassosoft.com

Michael Benedict

unread,
Jun 27, 2007, 4:57:43 PM6/27/07
to Lasso Talk
I create .txt and .tab files for my clients to download. Works great. BUT my
clients are always a little confused when they open the docs and they have
some extra interface to deal with.

Is there a way to create a "real" Excel (.xls) data file using Lasso?

Thanks in advance,
Michael

Greg Willits

unread,
Jun 27, 2007, 5:01:13 PM6/27/07
to Lasso Talk
On Jun 27, 2007, at 1:57 PM, Michael Benedict wrote:

> I create .txt and .tab files for my clients to download. Works
> great. BUT my
> clients are always a little confused when they open the docs and
> they have
> some extra interface to deal with.
>
> Is there a way to create a "real" Excel (.xls) data file using Lasso?

<hijack>

I've seen this asked and answered a few times now, and it seems whom
ever it is that ends up explaining how to do it might consider writng
an article on ldml.org so it's available to reference.

</hijack>

-- gw

Rick Draper

unread,
Jun 27, 2007, 5:07:13 PM6/27/07
to Lasso Talk
[Repost]

[snip]

A tip I picked up on this list a while back is to create the file in
XML, and save it with an xml file extension. By creating a sample file
in Excel and saving as XML, you can see the syntax very clearly, and
creating one on the fly becomes very easy - you can even add formatting
/ colours / etc. An example of one we are using is included below -
sorry I didn't have time to trim it down, but it should give you an
idea.

The only trap is that the user needs to have a relatively current
version Excel, as earlier versions don't recognise the xml formatted
files.
[/snip]
---------------

Example

Var:'ExportFileName'=$o_User_Ref;
Var:'ExpandedRowCount' = $Found_Count + 1;

Var:'Rows'='';
Var:'Table_End'='</Table>';


// Set the column headings
Var:'Column_1'='Last Name';
Var:'Column_2'='First Name';
Var:'Column_3'='Department';
Var:'Column_4'='Division';
Var:'Column_5'='Business Unit';
Var:'Column_6'='Access Groups';
Var:'Column_7'='Security ID#';
Var:'Column_8'='Card Type';

// Set the First Row to be Column Headings

$Rows +='<Row ss:AutoFitHeight="1">'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_1+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_2+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_3+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_4+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_5+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_6+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_7+'</Data></Cell>'+
'<Cell ss:StyleID="s25"><Data
ss:Type="String">'+$Column_8+'</Data></Cell>'+
'</Row>';

//Set the number of columns to match above
Var:'ExpandedColumnCount' = 8;


Records:-InlineName='UserResults';
If:$o_Stakeholder_Type >> (Field:'Stakeholder_Ref');

// set up row
$Rows += '<Row ss:AutoFitHeight="1">';
//Set Column 1

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows +=
(Field:'User_Last_Name');
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 2

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows +=
(Field:'User_First_Name');
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 3

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
If:(Field:'User_Department')
!='';
$Rows +=
(Field:'User_Department');
Else;
$Rows +=
(Field:'User_Organisation');
/If;
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 4

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows +=
(Field:'User_Division');
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 5

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows +=
(Field:'User_Business_Unit');
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 6

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';

Var:'Group_Names'=(Array);
Var:'Group_list'='';
Inline:
-Database=$database,
-Table=$groupstable,
-Username=$UN,
-Password=$PW,
-Op='Eq',

'User_Ref'=(Field:'User_Ref'),
-Op='Eq',
'Display'='1',
-Search;
Records;
Inline:

-Database=$database,

-Table=$groups,

-Username=$UN,

-Password=$PW,

-Op='Eq',

'Group_Ref'=(Field:'Group_Ref'),

-MaxRecords='1',

-Search;

$Group_Names ->(Insert:(Field:'Group_Description'));
/Inline;
/Records;
/Inline;
$Group_Names->(Sort: True);

Iterate:$Group_Names,(Var:'Group_Name');
$Group_List +=
$Group_Name+', ';
/Iterate;
$Group_List =
(String_RemoveTrailing: $Group_List, -Pattern=', ');
$Rows += $Group_List;
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 7

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows += (Field:'User_Ref');
$Rows += '</Data>';
$Rows += '</Cell>';


//Set Column 8

$Rows += '<Cell ss:StyleID="s26">';
$Rows += '<Data
ss:Type="String">';
$Rows +=
(Field:'User_Card_Type');
$Rows += '</Data>';
$Rows += '</Cell>';

// after last column
$Rows += '</Row>';


/If;

/Records;

Var:'Workbook_Header'=
'<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties
xmlns="urn:schemas-microsoft-com:office:office">
<Author>Amtac Report Generator</Author>
<LastAuthor>Amtac Report Generator</LastAuthor>
<Created>'+(Date_Format:(Date_LocaltoGMT:
(Date)),-Format='%Y-%m-%dT%H:%M:%SZ')+'</Created>
<LastSaved>'+(Date_Format:(Date_LocaltoGMT:
(Date)),-Format='%Y-%m-%dT%H:%M:%SZ')+'</LastSaved>
<Company>Amtac Professional Services Pty Ltd</Company>
<Version>11.6568</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>14955</WindowHeight>
<WindowWidth>24780</WindowWidth>
<WindowTopX>480</WindowTopX>
<WindowTopY>90</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s25">
<Alignment ss:Horizontal="Left" ss:Vertical="Top"
ss:WrapText="0"/>
<Borders/>

<Font ss:FontName="Verdana" x:Family="Swiss" ss:Size="10"
ss:Color="#000000" ss:Bold="1"/>
<Interior ss:Color="#FFFFFF" ss:Pattern="Solid"/>

</Style>
<Style ss:ID="s26">
<Alignment ss:Horizontal="Left" ss:Vertical="Top"
ss:WrapText="0"/>
<Borders/>
<Font ss:FontName="Verdana" x:Family="Swiss" ss:Size="10"
ss:Color="#000000"/>
<Interior ss:Color="#FFFFFF" ss:Pattern="Solid"/>
</Style>
</Styles>';

Var:'Workbook_Contents'='<Worksheet ss:Name="Export
'+$ExportFileName+'">';

Var:'Table_Start'='<Table
ss:ExpandedColumnCount="'+$ExpandedColumnCount+'"
ss:ExpandedRowCount="'+$ExpandedRowCount+'" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="200">';

$Workbook_Contents += $Table_Start;

$Workbook_Contents += $Rows + $Table_End;


Var:'Workbook_Footer'='<WorksheetOptions
xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header
x:Data="&amp;C&amp;&quot;Arial,Bold&quot;SECURITY-IN-CONFIDENCE"/>
<Footer
x:Data="&amp;C&amp;&quot;Arial,Bold&quot;SECURITY-IN-CONFIDENCE"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions></Worksheet></Workbook>';

Var:'Workbook'=$Workbook_Header + $Workbook_Contents +
$Workbook_Footer;

Inline:
-Username=$UN,
-Password=$PW,
-Nothing;

File_Create:
'/reports/files/'+$ExportFileName+'.xml',-Overwrite;
File_Write: '/reports/files/'+$ExportFileName+'.xml',
$WorkBook,-FileOverwrite;


/Inline;
[/Repost]


Very best regards,

Rick
Australian Head Office: +61-7-3297-0297
Toronto Project Office: +1-647-477-1643

Mobile/Cell: +61-411-595-830 / +1-647-502-0297

Steve Piercy - Web Site Builder

unread,
Jun 27, 2007, 5:19:22 PM6/27/07
to Lasso Talk
You can also reverse engineer an Excel workbook. Open the Excel file, save it as XML, then open the XML file in BBEdit to add your Lasso code.

--steve


On Thursday, June 28, 2007, Rick....@amtac.net (Rick Draper) pronounced:

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy Web Site Builder Soquel, CA
<w...@StevePiercy.com> <http://www.StevePiercy.com/>

Jason Huck

unread,
Jun 27, 2007, 5:31:41 PM6/27/07
to Lasso Talk
Here is a simple custom type that can create, read, write, and serve
CSV files in Lasso:

http://tagswap.net/csv

It does not include anything specific to MS Excel, but does conform to
the RFC for the CSV format as far as I am aware. Usage is fairly
straightforward:

// sample data
var('fieldnames') = array('Color','Number','Size');
var('data') = array(
array('Red',1,'small'),
array('Green',2,'medium'),
array('Blue',3,'large'),
array('Black',4,'extra large with "some" quotes')
);

// create a new CSV object
var('stuff') = csv(
-fields=$fieldnames,
-rows=$data,
-titlerow=true
);

// add another row
$stuff->addrow(array('Orange',5,'tiny'));

// write to a file (requires file perms, i.e., from within an inline)
$stuff->save('atestfile.csv');

// empty out our test variable
$stuff = null;

// create a new, empty CSV object
$stuff = csv;

// read in the contents of the file we just saved
$stuff->load('atestfile.csv');

// output the contents to screen
$stuff->output;

// serve the file to the user
$stuff->serve;


HTH,
Jason


--
Find and Share Free Lasso Custom Tags at tagSwap.net!
Download hundreds of open source Lasso custom tags, and post your own
for others to use. RSS feeds track the newest and most popular tags.
http://tagSwap.net/

Marc Vos

unread,
Jun 27, 2007, 5:49:20 PM6/27/07
to Lasso Talk
I do what Bil once did for us : create a var and fill it with HTML
code (incl. styles) and serve it as an application/ms-excel file.

var('excelf') = 'myExcelFile' + $zzSEQnr + '.xls';
var('excel') = '<table border="1" cellspacing="0" cellpadding="0"
style="font-family: Verdana">
<tr valign="top" height="40">
<td colspan="5" align="center"><h2>' + $zzTitle + '<h2></td>
</tr>
<tr valign="bottom">
<td width="90" align="right"><b>One<br>
column</b></td>
<td width="220" align="right"><b>Second&nbsp;<br>
column&nbsp;</b></td>
<td width="100" align="right"><b>Third&nbsp;<br>
column&nbsp;</b></td>
<td width="100" align="left"><b>Four</b></td>
<td width="250"><font color="red"><b>Fifth<br>
column</b></font></td>
</tr>';

$excel += '</table>';

file_serve($excel, -type='application/vnd.ms-excel', -file=$excelf);


That's all there is to it.

- -
Marc

Pierre Yelle

unread,
Jun 27, 2007, 6:53:47 PM6/27/07
to Lasso Talk

On 27-Jun-07, at 2:49 PM, Marc Vos wrote:

> I do what Bil once did for us : create a var and fill it with HTML
> code (incl. styles) and serve it as an application/ms-excel file.
>
> var('excelf') = 'myExcelFile' + $zzSEQnr + '.xls';
> var('excel') = '<table border="1" cellspacing="0" cellpadding="0"
> style="font-family: Verdana">
> <tr valign="top" height="40">
> <td colspan="5" align="center"><h2>' + $zzTitle + '<h2></td>
> </tr>
> <tr valign="bottom">
> <td width="90" align="right"><b>One<br>
> column</b></td>
> <td width="220" align="right"><b>Second&nbsp;<br>
> column&nbsp;</b></td>
> <td width="100" align="right"><b>Third&nbsp;<br>
> column&nbsp;</b></td>
> <td width="100" align="left"><b>Four</b></td>
> <td width="250"><font color="red"><b>Fifth<br>
> column</b></font></td>
> </tr>';
>
> $excel += '</table>';
>
> file_serve($excel, -type='application/vnd.ms-excel', -file=$excelf);
>
>
> That's all there is to it.
>
> - -

Yeah ! Is it not a beauty ?


I also found that converting to UTF-16 is useful, serving from a
Mac, when accented characters are in the data.
It is properly converted for Windows users downloading the excel file.

var:'winExcel' = (Bytes);
$winExcel->(importstring: $excel, 'UTF-16');


if:(client_browser) >> 'Mac';
file_serve: $excel, -type='application/vnd.ms-excel', -
file=..................;
else;
file_serve: $winExcel, -type='application/vnd.ms-excel', -
file=.................;
/if;

Pierre

JP

unread,
Jun 27, 2007, 10:43:24 PM6/27/07
to Lasso Talk
That is assuming that the person has Excel or Excel clone on the
computer.

I think CSV file will work best. Excel on the Mac WILL read it
correctly into an Excel worksheet. Excel on the PC (Windows) will
get prompted with a series of questions (aka wizard). I'm not sure
how Excel on the PC will handle CSV via the web browser -- think it
will come as a text file. I haven't done this on a PC for awhile.

jp

Rich

unread,
Jun 28, 2007, 3:30:37 AM6/28/07
to Lasso Talk
You can offer both, and the Excel file served, will open in Excel if
directed by the prefs in Safari. Asking a user to import into Excel
might be a chore. You know, like the clients I have.

On Jun 27, 2007, at 10:43 PM, JP wrote:

> That is assuming that the person has Excel or Excel clone on the
> computer.
>
> I think CSV file will work best. Excel on the Mac WILL read it
> correctly into an Excel worksheet. Excel on the PC (Windows) will
> get prompted with a series of questions (aka wizard). I'm not
> sure how Excel on the PC will handle CSV via the web browser --
> think it will come as a text file. I haven't done this on a PC for
> awhile.

Rich in Toronto

Marc Vos

unread,
Jun 28, 2007, 4:16:36 AM6/28/07
to Lasso Talk
Hey, that's a good one. I'll add it to the page and see what happens.

- -
Thanks,
Marc

Erik - Lasso

unread,
Jul 26, 2007, 6:10:46 PM7/26/07
to Lasso Talk
On Jun 27, 2007, at 3:08 PM, Israel Thompson wrote:

> Hello all,
>
> I've noticed a strange oddity with some of my images when using the
> Image->Scale tag. For some reason when I select the -Thumbnail
> attribute my
> image gets inverted (like a film negative where light and dark are
> opposites). When I use -Sample it doesn't happen, but the image's
> edges
> aren't as smooth.
>
> Anyone else run across this? And is there a fix or alternative?

Make sure original image is RGB and not CMYK color space.

Regards,
---
Erik Van-der-Mey • er...@webcentrix.net • (AIM/iChat: er...@mac.com)
WebCentrix, Inc. • Web Hosting/Co-Location/Dedicated Servers • http://
webcentrix.net
 Apple Authorized Business Agent • Store: http://webcentrix.net/aaba

Israel Thompson

unread,
Aug 17, 2007, 3:05:01 PM8/17/07
to Lasso Talk
>I haven't seen anything like that. Please send one of the problem
>images and the code you are using to <bu...@lassosoft.com> and we will
>look into it.
>Also, if you could mention what version of Lasso you are using and on
>what platform it is running.

Ok Fletcher,

I'm sending this over to your bugs department now.

BTW though, it appears that Erik is dead-on with his the work-around
solution response below. It appears, since the original image is CMYK this
is happening.

>Make sure original image is RGB and not CMYK color space.

Thanks Fletcher and Erik for your replies!

Sincerely,

Israel Thompson

Reply all
Reply to author
Forward
0 new messages