Skip to main content
Home Forums General Silverlight Getting Started Using non JPG/PNG images with Silverlight?
10 replies. Latest Post by ksleung on July 5, 2009.
(0)
rasmasyean
Member
82 points
165 Posts
07-05-2009 12:27 PM |
How do you do this? It looks like the built-in Image control has limited support.
ken tucker
All-Star
16302 points
2,487 Posts
07-05-2009 12:41 PM |
There is no way around it in silverlight. You would have to make a http handler for images on the server side to convert the image to one of the supported formats.
http://www.c-sharpcorner.com/UploadFile/desaijm/HTTPHandlersForImages11152005062705AM/HTTPHandlersForImages.aspx
07-05-2009 12:45 PM |
Can you build something to covert between formats manually?
ksleung
Contributor
5366 points
1,028 Posts
07-05-2009 1:13 PM |
No native support other than Png and Jpg, but if you really need it, besides from the Server side processing approach mentioned by Ken Tucker, you can also do it client-side with your own image decoder. It is not hard to find them, and if you don't mind GPL, there is already one that you can use (just search this forum).
07-05-2009 1:22 PM |
You mean that some image formats are "copyrighted" and you can't really use them on your own without some agreement?Is the Silverlight jpg and png limit because those are "free" ones and anybody can use?
07-05-2009 1:37 PM |
You misunderstood my reply. I was referring to the fact that:
(1) you can use some open-source Gif/Bmp decoders to decode images
(2) but some of the Gif/Bmp decoders are licensed under GPL. GPL license requires your entire source code to be licensed under GPL if you use anything GPL. If you are developing a close-sourced commercial application, and you use *any* GPL code, you just violated the GPL license (unless they give you a way out with dual license). In general, we need to be very careful about licenses because (a) we don't want to get into trouble later on, (b) if we are using open-source code, we need to honor the wish of the authors as far as under what condition you can use the code.
On the other hand, AFAIK, you are free to read/write Jpg, Gif, Bmp, Png formats. Gif used to be patented (?) but the patent has expired.
07-05-2009 1:39 PM |
Bitmap is not a good format for the web because of its size.
There are license issues with gif. Read the section Unisys and LZW and patent enforcement section
07-05-2009 1:49 PM |
That’s kinda lame. First of all, how are they going to know you “used GPL code”?Second, does this mean that they have claim on the “concept” of converting those image formats?What if you make up your own converter? What if you read their code and “modify” it?
07-05-2009 2:04 PM |
Not sure if I understand what you said. Not sure who you mean by "they".
You are free to write your own image converter. Nobody has any claim on you.
If you use other people's code, you are bound to the licensing agreement. This is not lame. Otherwise, it is called theft. Stealing is lame.
You can read other's code to understand it, and implement your own, it's fine. If you "transcribe" other's source code with only minor modification, it is still considered a violation. Otherwise, I think it is okay to reimplement, as algorithms cannot be copyrighted or patented (my understanding as a non-lawyer, may not be correct).
This is a serious matter. An entire company can be wiped out by stealing other people's IP. There is an interesting case "Cadence vs Avanti" where some source code was alledgedly stolen by Avanti, a startup competing against Cadence. Later on, Avanti becomes successful, and poised to significantly overtook Cadence's market. One day a customer, who used both Cadence and Avanti software, discovered that an error message has the EXACT SAME TYPO in Avanti's software as in Cadence's software. He then notified Cadence, and the whole enchilada follows, eventually leading to jail time and big penalty.
07-05-2009 4:04 PM |
Well, I understand that if you steal closed source code or implement some invention that is done by someone else it’s theft on IP. But if you used something “published” as open source, you have to publish your entire code? So if you use an image converter you found on the internet for an enterprise system, you will either have to open up the corporation’s source code or rewrite it in another language? That’s pretty unrealistic. What’s the purpose of having a GPL clause like that? That seems unenforceable. I’m sure there are A LOT of open source code used all over the place in closed source applications with little to no modification.
07-05-2009 4:25 PM |
rasmasyean:Well, I understand that if you steal closed source code or implement some invention that is done by someone else it’s theft on IP. But if you used something “published” as open source, you have to publish your entire code? So if you use an image converter you found on the internet for an enterprise system, you will either have to open up the corporation’s source code or rewrite it in another language? That’s pretty unrealistic. What’s the purpose of having a GPL clause like that? That seems unenforceable. I’m sure there are A LOT of open source code used all over the place in closed source applications with little to no modification.
Rasmasyean,
That's exactly the point of GPL... so that whenever that's open cannot be taken away. So, if you can't accept GPL, don't use it! That's also why I said, in the very first reply that, if you don't mind GPL...
Not all open-source are GPL licensed. In fact, I have a closed-source app and I use a lot of open-source code but *none* of GPL. There are code that are public domain, BSD-licensed, MIT-licensed, Microsoft permissive licensed (e.g. some Codeplex). All of them are for you to use, subject to minimum requirement (no false representation, must include copyright notice, etc). Also if you find a GPL code, you can study it and reimplement it in the same language. Just don't copy it (or transcribe it). The key is that you have to do it with your own effort, but you can read and learn the algorithm.
Despite the restriction, it doesn't mean that GPL is "bad". I think the GPL is a huge cornerstone of the open source movement and many projects won't be successful were they not GPL'ed (e.g. Linux).
Last but not least, the whole discussion is not about enforceability. Most likely if you use GPL code you won't be caught, but that's not really the point.
I think it is important to under licenses and patents and all. I used to work for a company where this issue almost destroyed it, so I know it's serious matter.