| Deutsch English Français Italiano |
|
<f8rbpr$2ggj$1@biggoron.nerim.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feed.xsnews.nl!border-1.ams.xsnews.nl!feeder1.cambrium.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!oleane.net!oleane!nerim.net!biggoron.nerim.net!not-for-mail
From: Eric Hassold <hassold@evolane.com>
Newsgroups: comp.lang.tcl
Subject: Re: resizing JPEGs --- SOLVED
Date: Thu, 02 Aug 2007 03:25:06 +0200
Organization: Nerim -- xDSL Internet Provider
Lines: 149
Message-ID: <f8rbpr$2ggj$1@biggoron.nerim.net>
References: <Ywcri.18953$5y.5070@newsfe18.lga> <vtFri.14753$g86.10345@newsfe14.lga> <PuKri.24256$GO6.15012@newsfe21.lga> <CaMri.13754$Od7.11960@newsread1.news.pas.earthlink.net> <wyPri.18727$rH6.15235@newsfe22.lga>
NNTP-Posting-Host: evolane.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: biggoron.nerim.net 1186017915 82451 213.41.241.187 (2 Aug 2007 01:25:15 GMT)
X-Complaints-To: abuse@nerim.net
NNTP-Posting-Date: Thu, 2 Aug 2007 01:25:15 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.5 (Windows/20070716)
In-Reply-To: <wyPri.18727$rH6.15235@newsfe22.lga>
Bytes: 6924
Hi,
Let me propose just another option, called Pixane, just in case you wish
to condider as many solutions as possible.
http://www.evolane.com/software/pixane/index.html
This is a Tcl API to read, write and manipulate images in Tcl (Tk not
required). It used to be available only as part of our eTcl distribution
(which supports a large variety of platform), but we released today a
standalone distribution, as dynamic libraries, also with support for a
large set of platforms, i.e. Win32, WinCE, MacOSX (x86 and powerpc),
linux (x86, arm, powerpc, mips).
Those loadable libraries has no external dependencies at all, and can be
used with nearly any Tcl distrib (tested with ActiveState and tclkits,
and of course eTcl while pointless since it is already part of official
distrib).
Pixane offers more than just read/write/scale images. [pixane] and
[pixfont] commands (both provided by those libraries) are described here:
http://www.evolane.com/software/pixane/pixane.html
http://www.evolane.com/software/pixane/pixfont.html
It's still missing good documentation and recipes, but below is a sample
code to illustrate how to achieve your goal with it.
Regards,
Eric
--
# Init package
package require pixane
# Create and load source image
set psrc [pixane create]
pixane load $psrc -file test.jpg
# Maximal geometry for target image
set maxw 240
set maxh 240
# If true, preserve ratio
set ratio 1
if {$ratio} {
set srcw [pixane width $psrc]
set srch [pixane height $psrc]
if {$maxw*$srch<$maxh*$srcw} {
# Scale factor is $maxw/$srcw
set vw $maxw
set vh [expr {($srch*$maxw)/$srcw}]
} else {
# Scale factor is $maxh/$srch
set vw [expr {($srcw*$maxh)/$srch}]
set vh $maxh
}
} else {
set vw $maxw
set vh $maxh
}
puts "Scaling ($srcw x $srch) => ($vw x $vh)"
# Create target image
set pdst [pixane create]
pixane resize $pdst $vw $vh
pixane blank $pdst
pixane scale $pdst $psrc
# Save image. That's all
pixane save $pdst -file test_small.jpg -format jpeg
-----
Eric Hassold
Evolane - http://www.evolane.com/
spooky130@cox.net wrote :
> In article <CaMri.13754$Od7.11960@newsread1.news.pas.earthlink.net>,
> Roy Terry <roy@terryhome.org> wrote:
>
>> How did xphoto.dll not meet your needs?
>> http://wiki.tcl.tk/11924
>
> Quite possibly because, until I just now read your post, I'd never
> heard of it. :-) Still, it's working now, and it's a lot simpler
> to ask a Unix user to have netpbm (which, even from its pbmplus days,
> has always seemed to be a very popular package that's likely ALREADY
> installed than it is to ask them to patch/rebuild/reinstall their
> Tk 8.[2-4].x.
>
> I don't mean to sound negative towards xphoto.dll and the work that
> you've put into it...really, I don't. If it were built as an
> external shared library (dll for windows boxes, libxphoto.so for
> Unix systems, etc.), I'd probably switch to it, but I'm trying to
> consider my users, who range from A) experienced Unix types who,
> when they have ideas for new features, learn Tcl/Tk, code it, and
> then send me a patch file (yes, a real patch file) to B) windows
> users who send me a plea for help every time the NHC/TPC ftp server[1]
> tells them in its motd that it's a US Gov't system and that misuse
> of the system is a federal offense (ok, I've only gotten a few of
> those from the same user, but I've gotten a *LOT* of those from
> different users)....
>
> Later,
> --jim
>
> [1] I originally wrote JStrack for Unix, designing it to get its data
> from incoming e-mail via the WX-ATLAN list, procmail scripts that
> pipe NHC/TPC products to filt.tcl, and filt.tcl and read_fc.tcl,
> which "read" the NHC/TPC products and extract the data to feed it
> to JStrack (whether it's running or not...if it's not running, if
> the user isn't logged in, whatever...the changes are there when
> the user runs JStrack again.
>
> But, since JStrack is all Tcl/Tk (with the ability to use external
> libraries/binaries for added capabilities), I wanted to get it
> running under windows, too, so I could support that whole big
> group of users as well.
>
> Unfortunately, unless something's changed recently and I don't
> know about it, procmail doesn't run on windows[2], nor is there
> any portable (i.e., doesn't matter what e-mail program the user
> is using) solution, so using WX-ATLAN for updates there is out.
> Thus, ftp from the NHC/TPC's ftp site.... It's not as reliable
> (when the ftp server gets too busy, it drops connects fairly
> regularly), but it basically works, as long as the user connects
> again until JStrack tells them it's finished.
>
> [2] { set joking_around_sarcastic_mode ON
> I think it might have something to do with handling every possible
> MTA/MDA/MUA combo program out there, since there doesn't appear to be
> a way to drop in a replacement for the MDA portion of the programs....
> }
>
> I've asked various self-proclaimed "experts" (they had one of those
> bits of paper that M$ gave them), after they claimed that *ANYTHING*
> that could be done on Unix, they could do better and more easily on
> windows (from that, they've just said that they *DO* know how to do
> this).... Sadly, however, the best response these "experts" could
> give was "you can't do that...but why would you want to?" (This,
> after I'd just explained why along with my question---to get procmail
> and filt.tcl up and running....) I've yet to get a valid answer to
> that question from these "experts". :-)
>