Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cropping Image  RSS feed

 
pollai mandala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a problem with VJ++ Image Cropping. Can anybody look into this? This is very urgent.Here i am giving you a brief explanation of my problem.
I am developing a VJ++ application, in which one image window and some empty windows are opened by the user.i have to let the user to select some area from the image window(ofcourse a polygon) and to drag it into the another empty window. I have done all the drag-n-drop portion.But cropping the image, and pasting it in the other window became a very big problem. The reason is, i should not use the Java 2 for my application,coz VJ will not support it.I could use PixelGrabber to get the image data( pixels into int[]); But in VJ, there is no mothed that
accepts int[].The only data type the VJ api can accept is short[].At the same time there is no class/method to grab the pixels into short[] in VJ.
SO, the question is, how to convert this int[] data into short[] data without loosing the pixel values ( i mean, the color values).
I am very eager to hear from you.
Thanks and Regards,
Bhavani
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always use java.awt.image.MemoryImageSource to create an image from int array in PixelGrabber... However, I haven't use VJ++, so check if MemoryImageSource is provided...
-Nate
 
pollai mandala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well,
thanks for your reply. I too have used this class but in VJ++
there is no similar class is provided.By the way let me tell
you some thing i have tried.
If you see how a pixel is being stored in an integer, there are
four bytes inteded for Opacity,Red,Gr,Bl values respectively,
where as the color model for short value(16 bit) takes 5 bits or
each R,G,B values and the left most bit for opacity.From the R-G-
B bytes i am taking fifteen bits, five from each.By simply
adding zero value for the left most bit , i am creating a new
short value.In this way i am creating the short[].
I dont think leaving three bits from each R,G,B color is a considerable image loss but I suspect ignoring this
transperancy component (by simply setting 0 or 1 to left most
bit) is the main dammage.Any way, i managed to show a blur image
in this way for now. I know this wo'nt work for big size
images.I am looking for a better idea from you all.
i await..

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!