|
Of course a general compression as used in ZIP can't do any better on images than the specialized JPEG compression that knows and understands what it is dealing with.
If you want a smaller file, you need to throw away some of the information; here are two ideas:
- reduce the number of colors
- reduce the image size
Yes, I know, both will reduce image quality as well.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
For extreme requirements like this, it may justify splitting the byte array into chunks, and using a custom compression algorithm for each chunk.
For example, you may find a run of several hundred pixels with the same value, which would compress nicely with run-length encoding: The single pixel value plus a repetition factor.
Other chunks may have different types of regularity you can exploit, such as a repeated block pattern.
The compressed image will end up as a list of chunks, each with a byte identifier (that gives the compression type for that chunk) followed by that chunk's data. To decompress, go through the chunks, read the byte identifier, then execute the corresponding code to reconstruct that chunk.
|
|
|
|
|
I had an in-process dll (built in Vs2008) which is injected in IE.
I want to create a pipe which should be continuously available for other application.
How can I create a pipe in c# and how can I make it available to the dll.
|
|
|
|
|
Hi everyone!
...From what I can understand, it's that the whole C# Plugin Architecture thing isn't as good as I thought it would be.
I first came up with an idea to (somehow) develop my application in such a way that it would be possible to add functionality at a later time without actually having to go back into the main application project and edit/add code to it, and to also be able to add ANY feature at all (limited only to the imagination.) I would have liked to simply create a DLL (or whatever) and send it to a user and say "Hey man, add this to the "MyApplication" directory and then open "MyApplication". But, out of the 9 articles I've read online, it's become quite apparent that you cannot do that. In order to make a "plugin" work with your program, you must tell your program to look for it. In other words, your program will be 'expecting' "this" plugin. And if you try to open a different plugin that isn't described in your application, it won't work.
I think I might be a little crazy, but I also think that I'm right, going by the 9 articles I've read in the past week. Unless I've misunderstood all 9 articles...
Can anyone please shed a little light on this for me?
Thanks,
schizophrenic PrOgRaMmEr (formerly jase, jt and jay)
|
|
|
|
|
Yes, your application must know about plugins. But if those plugins conform to a common interface, then your application will know what to do with them.
When I wrote a plugin system a couple of years back it used interfaces. The main application would scan a directory for DLL's, use reflection to see what interfaces they implemented, and if they used the interface I was expecting, then I would load the DLL and use it.
I'm pretty sure there are articles on this site describing a similar method...
|
|
|
|
|
Yay thanks for your quick reply!
So, if my application 'knows' about plugins that conform to a particular interface for example a "Drawing Interface"...? I could create plugins that enable the user to View a photo and another to Edit a photo..? I mean, my application only needs to know what "type" of plugin it will be, correct? Not "exactly" what it will do?
Thanks for yout time 
|
|
|
|
|
Yes thats pretty much it.
I think this article might help: Plug-ins in C#[^]
|
|
|
|
|
Thanks for your help HuntingWabbits That article was very helpful. Much appreciated.
jase
|
|
|
|
|
schizophrenic.prOgrAmmEr wrote: C# Plugin Architecture
You might also want to take a look at the Managed Extensibility Framework http://www.codeplex.com/MEF[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Hmmm... That's very interesting. I'm always on CodePlex, I'm surprised I haven't already found it. Thanks for that Wes Aday!
I'm reading about it now and will check it out. Oh the excitement!! 
|
|
|
|
|
You are welcome. Hope you find it useful.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Hello,
I am using PhilipSoft Control of datalist to show the images.But i am having checkboxes along with each image. I want to get the Ids of checked images.I have bound the datalist by assigning a dataset to it.
How can i get it?.
Please help me as early as possible.
<ASP:DataList id="MyThumbList" RepeatDirection="Horizontal" RepeatColumns="4" CellSpacing="3" runat="server" EnableViewState="true" OnItemDataBound="Item_DataBound"
OnEditCommand="ThumbList_EditCommand" OnUpdateCommand="ThumbList_UpdateCommand"
OnCancelCommand="ThumbList_CancelCommand">
<ItemStyle font-size="8pt" horizontalalign="Center" borderwidth="1px" borderstyle="Solid" backcolor="White"></ItemStyle>
<FooterStyle font-size="8pt" horizontalalign="Center" backcolor="#FFFFC0"></FooterStyle>
<HeaderStyle font-size="11pt" font-bold="True" horizontalalign="Center"></HeaderStyle>
<SelectedItemStyle backcolor="#E0E0E0"></SelectedItemStyle>
<EditItemStyle borderwidth="1px" borderstyle="Groove"></EditItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkImage" runat="server" ValidationGroup='<%# AltString((String)((DataRowView)Container.DataItem)["Filename"]) %>' /><%--ValidationGroup='<%# AltString((String)((DataRowView)Container.DataItem)["Filename"]) %>'--%>
<a target="_blank" onmouseout="deleteImage()" onmouseover="callImage('<%# ThumbUrl((String)((DataRowView)Container.DataItem)["Filename"]) %>',event)" href="<%# String.Format("{0}/{1}",_vpath,
((DataRowView)Container.DataItem)["Filename"]) %>" >
<img border="0" src="<%# ThumbUrl((String)((DataRowView)Container.DataItem)["Filename"]) %>"
alt="<%# AltString((String)((DataRowView)Container.DataItem)["Filename"]) %>" /></a>
<%# _bShowFilenames?"<br/>"+((DataRowView)Container.DataItem)["Filename"]:"" %>
<%# ShowComments?"<br/>"+((DataRowView)Container.DataItem)["Comment"]:"" %>
<br/>
<%-- <asp:LinkButton id="button1" Visible='<%# AllowEdit ? true:false %>'
Text="Edit" CommandName="Edit" runat="server"/>--%>
</ItemTemplate>
<EditItemTemplate>
<a href="<%# String.Format("{0}/{1}",_vpath,
((DataRowView)Container.DataItem)["Filename"]) %>" >
<img border="0" src="<%# ThumbUrl((String)((DataRowView)Container.DataItem)["Filename"]) %>"
alt="<%# AltString((String)((DataRowView)Container.DataItem)["Filename"]) %>"
/></a>
<%# _bShowFilenames?"<br/>"+((DataRowView)Container.DataItem)["Filename"]:"" %>
<ASP:TextBox id="txtFilename" Visible='false'
Text='<%# ((DataRowView)Container.DataItem)["Filename"] %>' runat="server"/>
<br/><ASP:TextBox id="txtComment" Multiline='true' size='30' Rows='4' TextMode="MultiLine"
Text='<%# ((DataRowView)Container.DataItem)["Comment"] %>' runat="server"/>
<br/><asp:LinkButton id="button2" Text="Save" CommandName="Update" runat="server"/>
<asp:LinkButton id="button3" Text="Cancel" CommandName="Cancel" runat="server"/>
</EditItemTemplate>
<HeaderTemplate>
<%# HeaderTitle %>
</HeaderTemplate>
<FooterTemplate>
<%# NumImagesDisplayed() %>
<tr style="font-size: 8pt;" align="center">
<td colspan="<%# Columns %>">
<p >
<asp:PlaceHolder id="plLinks" runat="server"></asp:PlaceHolder>
</p>
</td>
</tr>
</FooterTemplate>
</ASP:DataList>
|
|
|
|
|
I nearly posted this in the Lounge as I think it's far enough from a Programming QuestionTM but decided last minute to put it here:
Is the C# keyword var a good thing or not? Was it added just to make C# closer to VB.NET or is it actually a good thing in its own right? Does it make it easier to write programs or are the actually harder to maintain because the code doesn't make it clear what type the variable is?
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
|
|
|
|
|
I think it's good. It allows me to use anonymous types in queries. And they get converted to normal variables at compile-time, so there's no runtime overhead. As for the variable types, most good IDEs will tell you what type a variable is by hovering the cursor over it.
So I think it's good. 'dynamic' on the other hand -
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
It still generates a strong type internally, and without it Linq wouldn't really work - so, it's a good thing. It's not really akin to a variant.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Linq is new to me but I can see its advantages in anonymous queries.
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
|
|
|
|
|
Hi,
in my view it is as good as "continue" (or even "goto"): you can use it to your advantage and be fortunate to have it; and you can easily abuse it, it is all up to you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
It was added for Linq.
It gets abused too much.
Only weak programmers use it.
|
|
|
|
|
i want to delete a string from right of 10 places
Eg..
String = http://www.bharathretail.com/cyberwing/update_ip.php?gid=4274725472424242
but i want
string = http://www.bharathretail.com/cyberwing/update_ip.php
plz help..
Elizabeth...
|
|
|
|
|
string = string.substring(0,string.length -11)
|
|
|
|
|
Instead of removing 10 char from right you can use split function
Because not necessary that always you have 10 characters after “?”,
string path = "http://www.bharathretail.com/cyberwing/update_ip.php?gid=4274725472424242";
string[] ar = path.Split('?');
MessageBox.Show(ar[0]);
Amit
|
|
|
|
|
either you count in base 21 (that would be unumvigintal), or your example is wrong.
if you want to get rid of the querystring in string s, use s=s.Split('?')[0];
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I am working on Windows application and I created the validation for English language by using “RegularExpressions”. Now my application need to support Spanish language and my English validations are not working in Spanish.
Please help me what should I do.
Thanks in Advance
Amit
Amit
|
|
|
|
|
If you're just using regexes, then you simply add Spanish-validating regexes to your Resources. Then use something like this:
if(Spanish)
RegexValidate(SpanishRegex);
else if(English)
RegexValidate(EnglishRegex);
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi
Thanks for reply, but how to write "Spanish-validating regexes".
Because in English we use
"Regex objAlphaPattern = new Regex("[^a-zA-Z]");"
But what I need to write for Spanish.
Thanks
Amit
Amit
|
|
|
|