Brendan Kennedy

Ranch Hand
+ Follow
since May 02, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brendan Kennedy

Hi Alain,
I think your method is ok so your problem is probably to do with the bufferedimage you are passing to it. The image is probably black because the buffedimage you're writing is an empty buffer. What are you using to read in the image? Before changing to using the new ImageIO I used ImageIcon:
Image inImage = new ImageIcon(u).getImage();
You may also need to wait for the image to fully download, ie use media tracker (I've never used this, but here's some code):
MediaTracker mediaTracker = new MediaTracker(null);
mediaTracker.addImage(image, 0);
mediaTracker.waitForID(0);
Hope that helps
Brendan
19 years ago
hey
I want to change image bit-depths(always to lower them) to as low as 2 bit,
but also 4, 8 and 12 bits. I think my computer wouldn't be able to handle a 16
bit image... Are there any ways to reduce the amount of data (like read in the
data as greyscale instead of buffering and then changing) being read in . I
guess I could tell it to read in only every fourth pixel or something.. I
dunno.
Anyways, I need to know how to change the bit depths. I'm using java1.4 and
the latest JAI package, so all the ImageIO stuff for encoding and decoding.
BufferedImage's int values don't cut it(dont' go as far as 2 bit) and simply
thresholding the image doesn't either because my aim is to reduce the amount
of data being sent to the client and this would probably result in a high bit
image with 2 colors used
Thanks,
Brendan
19 years ago
I think I've figured it out. All relative links on the page are relative to
the url of the page, so all I need is to get the current url up till the last /
and add the relative url, unless the relative url starts with a / , in which
case I just use the hostname. I so hate string manipulation though :/
19 years ago
Hey,
I'm making this servlet that one would use to browse the web through. It
parses the html at a given url so as that all links point back to it as
follows:
<a href="http://somehosthost">link</a>
becomes
<a href="http://myhost:8080/student/servlet/myserv?url=http://somehosthost">
link</a>
by problem is relative urls within the page like <a href="mypage.html">
because there is no way to directly read this from my servlet. I could just
keep the hostname in my session context or something, but then what if the
relative url is from a page at
http://somehosthost/thisdir/thatdir/thepage.html ? I'll end up looking for it
in the base directory.
Anyways, i figure someone out there's done this before
Any help is greatly appreciated,
thanks in advance,
Brendan
19 years ago
Thanks for the replies
the xsl wasn't working totally fine. it was working ok in that the img tag was getting changed in the way I wanted. The elements were being sorted into the order they apeared in in the origonal file, ie with no children. I'm using xml spy 4.3 and (I think) the msxml parser.
The files I'm using are at :
http://www.redbrick.dcu.ie/~keno/ranch/
The other xsl there is trying it using templates.
I haven't gotten working with the identity template yet, hopefully that does it
Thanks again
Brendan
Hi,
I want to use xslt to convert xhtml to xhtml, just changing the attributes of some elements(img and a). It's all going well, except the output I'm getting is all the elements in the order they apear in the origonal. Here is my code:

How can I make it so's the node tree stays the same, with just my changes to the attributes of those elements?
Regards,
Brendan
Thanks for replying
I did sort of(there's still some kinks) come up with a method that uses bufered image though. I can check the width in pixels using the SampleModel, then check the widthheight of the bufferedimage(they don't give you units but I'm guessing this is in either cm or mm. So if I want an x resolution of 160 ppi(pixels per inch)I convert the width to inches, divide this number into my current resolution to get the x ppi. I then use an AffineTransform to make a buffered image 160/x times smaller and then an AffineTransformOp to make the image the desired size. This is done in conjunction with the same operatoin for the height.
My maths could be off as I only came up with that last night and I haven't really looked to deeply into it this morning. Also there's obviously going to be some sort of round off error due to haveing to convert form int to double and back...
Could you please give me some links to some JAI/JIMI tutorials?
Regards,
Brendan
19 years ago
hey
how do you check and then change the resolution of a BufferedImage?
Thanks,
Brendan
19 years ago
hey
I'm doing image processing for the palm os and am thinging of making some xml templates for different image formats and then using xsl to convert the different types to pdb format for sending to a pda. Now I know pdb is a database format and I was just wondering if you had any pointers or links to tutorials or whatever on converting images to pdb(like SplashData does). Even the pdb specification would be helpful although, I think if I'm working from that it'll take me longer than my final year project is worth, but how and ever...
Any help with the xml side of things is very appreciated too
Regards,
Brendan
19 years ago
ah, it's not. don't know how to feel
19 years ago
The directory it's in is.
I'm almost hopeing that isn't the answer cos I'm after giving out to the admins to try and get them to update the JNI drivers on the server :/
Anyways,
thanks,
Brendan
19 years ago
Hi,
I'm getting an error when I load the default toolkit.It's in the following line :
Toolkit toolkt = Toolkit.getDefaultToolkit();
I've also tried this instead of using the toolkit(I wanted to use it to manipulate an image):
Image image = (new ImageIcon("filename.jpg")).getImage();
but I keep getting the same error (an UnsatisfiedLinkError).
I'm using JAI with j2sdk1.4 and everything is being run on solaris 8
thanks
Brendan
19 years ago
I want to use (java)XSLT as a way of displaying results from a search. Is it faster to use a SQL database and then convert the results to XML, or use a large XML file, or use many small XML files?
The information base will eventually be very big, so I am wondering what is the best way to store it if I'm always going to be using XSLT for my front end.
On an unrelated topic, does anyone know if the Whitespace problem of JAXB(it removes all whitespace when you unmarshal your doc) has been fixed yet?
Best Regards,
Brendan
It's java version 1.3.0
Please tell me that I don't have to go writing c code for a native library and let your reason be that java imageing is cross platform compatible!
I have very little c programming knowlege and am loath to go learning another aspect of java while I'm only starting off on JNDI. Do you know any work arounds or c code examples?
Thanks
Brendan
19 years ago
yes, the image I'm working on is in the same directory as the class and I've exported CLASSPATH=.
Could it be the actual JNI that's the problem? I'm on a solaris machine with j2se installed. Or could it be memory constraints (I don't think so, i think there's a different error for that).
Thanks
Keno
19 years ago