-3

friends! Please, if anybody knows how to compress image files through standart java tools? I want to send image files through UDP packets but I'm getting exception that images size is too large!!! Please, any suggestions!!!

Bob
  • 1
  • 1
  • 4
  • 1
    You'll have to send *many* UDP packets. UDP is *not* like TCP - *you* have to split up and reconstitute/re-order the data as appropriate. Or, better, use TCP (or better, a higher protocol). For "compressing" images, just use PNG (or even JPEG) to start with. If this is done, then the images should already been in a "non-compressible" state meaning that their bits represent a high ratio of information. –  Feb 13 '13 at 03:49
  • Tip: Posting the relevant code and *actual* error message will result in better responses on stackoverflow. –  Feb 13 '13 at 03:53
  • Hi, thank you for you reply! I have used TCP protocol but speed was not good enough! That is way I have started to write in UDP protocol! And can you give me any examples of higher protocols which I could to use to solve this problem! – Bob Feb 13 '13 at 04:55
  • TCP is fine. Actually, it's *much better* than UDP for sending a [continuous] stream of data. UDP is nice for small "fire and forget" or "please get there as fast as you can but it'll maybe be okay if you don't" packets .. but not streams. –  Feb 13 '13 at 05:58
  • Hi! U said that TCP is fine! if it is so, please can you give me any examples of how to improve data streaming!!! Because when I have tried to do that with TCP, a speed of frames in a second was 9fps...! :( "it is not good for me"! At least I have to got 25-30fps!!! Please, help! :) – Bob Feb 13 '13 at 06:33
  • I do not know why UDP faster! I've just read about that usualy UDP uses in audio and video streaming and I guess that UDP have to be fine to send thoes images through network! There is no problem with TCP. It works but very slow and I guess that I have to reduce size of images?? – Bob Feb 13 '13 at 07:00
  • A general idea is to get display or screen of remote PC, ipad, andriod based gadgets and so on...! :) – Bob Feb 13 '13 at 07:02
  • Look up "VNC" or "RDP". –  Feb 13 '13 at 07:19

1 Answers1

0

Take a look at ImageWriteParam or pngtastic

Matt Busche
  • 14,216
  • 5
  • 36
  • 61
  • Thank you Matt! I have used that ImageWirterParam class and size was compressed as quality. But, when I'm tring to send them through UDP socket, in client side (who receives all that stuff) do not to show them in frame??? what is the problem? And what should I do to improve its' quality again?? Thank you, Bob – Bob Feb 13 '13 at 06:38
  • I just can not to see thoes sended images in remote PC (receiver side). Please, help! – Bob Feb 13 '13 at 06:39