|
I have an image of more than 2 megabytes that can not open in any program,
so I need to resize it so that any program can open if I could carry it in the program would be easy but it has an error OUT OF MEMORY someone tell me how to resize the image without loading in C Sharp
|
|
|
|
|
Hi,
an OOM exception does not always really mean you ran out of memory! Look here[^].
I suggest you first validate your image file by opening it succesfully with one of the reputed image processing programs, such as Adobe Photoshop.
|
|
|
|
|
I agree with Luc - I regularly work with images much bigger than 2Meg without problems in C#. I would suspect your code is at fault - try it with a small test image, and it will probably give the same error.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
The problem is not in my code is on the image that is a bmp and is a large map and i tried to open the image with Irfanview with Quantum gis and with the Gimp and the Windows can not read the image data. I want to resize the image from the file system and not from the image that appears on the screen.
I have not harmed any tree to write this message but have produced a lot of smoke trying to resize the image.
Thank's
|
|
|
|
|
Since nothing is opening it, it would appear that the image file is corrupted or otherwise not in an expected and supported format.
Just for giggles, what are the dimensions of the image, in pixels, and the color depth?
|
|
|
|
|
The windows can not give me this data but I made a program that gave me
height= 25163 px
width = 38180 px
rate of bits = 24
|
|
|
|
|
That would be more than 2 gigabytes which is a different issue entirely. Adobe editor products will open a file this large in win32; but very little else will. A while back I found a free GIS viewer that would load a monster image but can't recall what it was called. If it's only a one off your least painful option might be to use a liveCD to use the linux version of GIMP to resize it; as of a year ago the win32 version puked on a file that big. I haven't tested under win64, so I don't know if that combo would work any better.
The latest nation. Procrastination.
|
|
|
|
|
There is no contorl that is going to load that image. You have to either find a library that will do what you want without loading the image, or write one yourself. Writing one yourself is NOT a trivial task, since you must known what the exact format of the image file is and how to work with the data. Then, you need to know about other image processing algorithms to pick out and blend individual pixels so that you can assemble the data in a smaller file, again, knowing the exact format of the image file you want write.
|
|
|
|
|
sorry I was wrong the image is 2.68 gigabytes
not 2 megabytes. Can anyone help me?
|
|
|
|
|
I think the problem may be your image then. I regularly deal with images that are in excess of 170Meg without problems, and as a simple test, I just saved one of these as a 8.5Meg .BMP file. In Paint (surely the most basic of basic rubbish image programs), it opens, edits, and saves without problems.
I would try with a different image; I suspect yours is not what you think it is.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
sorry I was wrong the image is 2.68 gigabytes
not 2 megabytes. Can anyone help me?
|
|
|
|
|
The only thing I can think of is to get a handle to the file without actually loading the file into memory (OpenFile [^] may do this - if not, there may be other functions that will).
Once you have that, you can read the data in the file in sections and do what you wish with them, carefully disposing of each section from memory as you go. You'll need to understand the image format so you can interpret the headers and the image data itself.
I have no idea with regards to the implementation of this - just an idea that may work.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Problem: Login failed for user '(null)'. Reason: Not associated
with a trusted SQL Server connection.
Request
This problem is generate when i connected with remote server
i want to connection between two server to transfer data from
one table to another.and i got data froms local server but when
connect to another server then this problem arise..
From Mr.Saunat Sharma
|
|
|
|
|
Would probably be a good idea to start by pasting the code, especially your connection string.
Also, have you checked the value of your User to ensure it's not null since that's showing up in your error message?
Also again, if you're trying to use trusted connection (rather than SQL security) are you ensuring the workstation is actually logged into a domain account with proper rights?
|
|
|
|
|
Are you using web services to connect to the remote server? I seem to remember an issue with user details not being able to be passed through from one web service to another.
|
|
|
|
|
thanx DoctorMick.
exactly as u r telling me.
This Problem arise when i am using windows service.
What i m doing,Access records from one table from local server.Store it in dataset and then i will go for inserting record to Remote server.But i am unable to connect to remote server.
|
|
|
|
|
This is part of my program that activates the mouse movement sensor once a checkbox is ticked.
What i want is for it to be activated by default.
I've tried editing the checkbox in designer view of the form, setting the value to true, but the mouse movement is still not picked up until the checkbox is unchecked then rechecked.
Im new to C#, im assuming it's something to do with "CheckedChanged"....?
This is the code for the checkbox:
private void checkBoxOnMouseMove_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxOnMouseMove.Checked)
{
HookManager.MouseMove += HookManager_MouseMove;
}
else
{
HookManager.MouseMove -= HookManager_MouseMove;
}
Any help at all would be greatly appreciated
modified on Friday, August 28, 2009 9:34 AM
|
|
|
|
|
You should add this line in your form load event.
if (checkBoxOnMouseMove.Checked)
{
HookManager.MouseMove += HookManager_MouseMove;
}
This will attach the event during the load.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
You need to add this into the form's constructor or Load handler too so the subscription is already active when the form loads.
HookManager.MouseMove += HookManager_MouseMove;
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Where and what is the form's constructor or Load handler?
My code is made up of bits and pieces here and there, so i dont know it inside-out. Just a brief understanding.
[EDIT] - never mind, i have found it and got it working
Thank you so much for the help
|
|
|
|
|
mostofmonty wrote: Where and what is the form's constructor or Load handler?
mostofmonty wrote: never mind, i have found it
Seems you are pretty C#-ignorant then, and just trying your luck at random. I suggest you do yourself a favor, buy and study a book on C#.
|
|
|
|
|
I do apologise for being new to C#.
I am interested in learning to write programs in C#, and am hoping to pick up as many things as i can through the questions i ask on this forums. Even if they are stupid.
I have my program working thanks to the help on this forum,
So again, i appreciate all the help
And i apologise for any future stupid/ignorant questions.
|
|
|
|
|
No need to apologize, everyone is new to something at some point.
However, rather than spending 100+ hours at asking 100+ questions and reading and testing all the answers, good and bad ones, you'd better take this advice[^]. And then ask more intelligent questions when they arise. Which we will be glad to answer.
|
|
|
|
|
I was considering buying a book on C#, but i shall take your advice and make it a priority
Thanks everyone for the help on my ignorant question, wont happen again
|
|
|
|
|