Convert Pixels To Cm/inch Or Cm/inch To Pixels?
Feb 28, 2009i have a problem with the Size in VB.Net I think the Control Size in VB.Net Is Pixels so I want to enter this size cm/inch
I want To Convert Pixels to cm/inch or cm/inch to Pixels
i have a problem with the Size in VB.Net I think the Control Size in VB.Net Is Pixels so I want to enter this size cm/inch
I want To Convert Pixels to cm/inch or cm/inch to Pixels
I have a picturebox that loads an image then resizes it and saves it which I know how to do in code
dim iBit as new Bitmap = picturebox1.image, picturebox1.width, picturebox1.height
What I want to do is be able to specify the Pixels Per Inch for the resolution.
I have scanned a few img's on 600 DPI. When i load them into a Bitmap class They have Vertical and Horizontal Resolution of 96 PPI To my calculation that is very close to 38 Pixels per centimeter. Now the image that I scanned is 4.5 Centimeter (1.77165354 Inch) In Diameter but When I measure It the 4.5 cm img is close to 1080 pixel in Diameter which is 240 Pixels/Centimeter (609.6 Pixels/inch) What is the correct way to get the actual Pixels per inch/centimeter from a bitmap or was it set incorrectly by my scanner ?
View 7 RepliesI have to know how to set system resolution of all tools in forms, which i using for my application.
I attached two screen shots. When i work my application with my system, form window and their tools placed correctly with my monitor fit(15 inch monitor).
But when i work my application in 21 inch monitor, all tools re arranged and
not in format. post me the code to set resolution as per system??
I'm trying to make a -what i thought would be simple app.My intention was to build program that:1) i'd provide a grayscale image2) the program would count the black pixels the grey pixels the more grey pixels etc. (the hue) and the white3) would make the percentage sum of all pixels, that is: 300.000 black pixels (rgb 0 0 0) etc. given that 0 is the black, 100 the white. e.g a simple grayscale image is 55.2 white
This was my way and i don't think that is useful:
First of a button to convert the image to greyscale:
Dim bm as new Bitmap(source.Width,source.Height)
Dim x
Dim y
[CODE]...
Secondly, -and that's the stupid way- i did -or better i wanted to do- this: i put the code to dynamically create labels, each label having the colour of a pixel as background colour and as text the colour converted to rgb
The third step which i intended to do (i couldn't get pas two) was to sum up the labels etc.
I need to convert between Drawing.Font.Size (float, ?) and WPF FontSize (double, WPF pixels).Finally, I decided to store in the database the fontSize in inch...How can I convert the GDI FontSize to inch and the WPF FontSize to inch?
sizeInInch = wpfFontSize / 96
sizeInInch = gdiFontSize / ?
Can I use something DPI independent? Maybe System.Windows.FontSizeConverter?I need to convert to something, that will allow me to switch multiple time between WPF and GDI without changing the "real value". Each division and following multiplication will accumulate errors...
FontSizeConverter does a ConvertTo, but I don't understand to use it:
myUniversalFontSize = (double)(myFontSizeConverter.ConvertFrom(
gdiFont.SizeInPoints.ToString() + "pt"))
will transform my gdiFont size in ...? WPF Pixels?How now should I convert back that value to GDI?
gdiFont.SizeInPoints = myUniversalFontSize / 96 * 72???
Can I use in the second example the myFontSizeConverter too?
How to convert twips to pixels with VisualBasic 2008?There is a windows application writen by vb6 and it has a main form 1000 twips high and it is in the top position. There is an another form writen by vb 2008 and i would like to fit under the vb6 form.[code]...
View 2 RepliesI have desiged some checks in inch.Now,i want to print check.I must know the printer's DPI(Dots Per Inch).
View 2 RepliesIs there any prebuilt items to roundup a number to set fraction size or do I need to build a routine to do this? If I have to build this any thoughts on the way to go about it? I was thinking I need to strip the decimal places and then compare them to a dataset of numbers a make a choice?
View 3 RepliesI've googled and binged my browser to an inch of it's life, but i'm still no nearer to an answer for this, so I'd be grateful for some advice. Mainly with the syntax, but knowing me the whole concept is wrong!I have a textbox. When user enters a string and presses enter, I want the following to happen.
I'm struggling with 3 and 4 and 7
1. Check the string is not more than 13 characters, if so trim the last characters off to make 13
2. Find if the first character of the string is a digit or a letter
3. Convert the string into an array of INT
[Code]...
I want to create small 1,5 x 1 inch image/logo spinning in the upper right corner of my app.I have tried to find a solution reading posts and tutorials on OpenGL, DirectX, GUI+. how to create this using vb.net (using vs2008)?Here is a link to a spinning logo (forget the program, just the logo), like I want to create. I have a .jpg image that I want to use.[URL]
View 5 Repliesi need to get a progressbar to move 1 "inch" every time my timer restarts... and that the max value should be the total sum of hour...min...sec
This is what ive got sofar:
TotValue = Val(Hour.Text) * Val(3600)
TotValue = TotValue + Val(Min.Text) * Val(60)
TotValue = TotValue + Val(Sec.Text)
This calculate now i want those seconds to be a the maximum size of the progressbar... And to make it go one step everytime my timer restarts... =)
i`m trying to find in cm or mm the area of a frame (capture image).The picturebox has dimensions height:456 and width:553 PIXELS.So the total number of pixels are 456 x 553 = 252,168
If i compare image 1 with image 2 i can locate and draw a rectangle around that area of pixels that are different.i can get the width and the height of this rectangle in PIXELS.e.g Height:49 Width:33 PIXELS
How can i covert these into cm or mm. What i need to know for the conversion?
I know dpi: dots per inch but what`s the value for my rectangle?
I would like to believe that this code will display a horizontal line halfway across the PictureBox pbxData. In fact, what it does is create the BitMap and then blow up with a memory violation when trying to copy the BitMap into the PictureBox. The code that alters the array is commented out because I don't know how to address the elements of the array.
how to make this into useful code?
Imports System.Runtime.InteropServices
Public Class Form1
Private b1 As Bitmap
[Code].....
How can we get the pixels of an image in a fast way?
View 1 RepliesWas just wondering if there is a way to quickly clear all pixels in a bitmap without creating a new one?
View 1 RepliesIs there a way of converting pixels to points? The dimensions in VB are in pixels, but Office COM such as WordApp.Resize are expressed in points. So trying to align app windows is a mess.I guess the ratio of pixels to points varies from one monitor to another(?), so this would need to be calculated at run time.I tried a nifty trick of doing Me.Font.SizeInPoints / Me.FontHeight but that doesnt seem to be quite right or a very sensible way of doing it.
View 2 Replieshow can i get a full code or full information how to work with image and pixels i want to work with image by pixels as integer number not as color?
View 5 RepliesIs there a "MOUSEEVENTF_Click"? Also,How would I change this code so that it will click when I move/click my mouse wheel?
If MOUSEEVENTF_WHEEL Then
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End If
EDIT: How would I move the mouse down? Like -10, -10 pixels? or something like that.
i made this class to get certain pixels from screen:
[Code]...
Now i have lets say and array of pixels Example: Pixel 1 position X:100 Y:200 Red: 200 Green: 30 Blue: 40 Now i need to search all the sreen to find that pixel witout knowing its position. I need to have an output of number of results found and their position tnx.
I have a form that starts at a specific point (the right side of the left screen on an extended desktop). I am trying to work with users with different resolution. Insteadof changing the resolution to match the application, I want to try and get the size of the desktop (1280 x 2 for an extended desktop, 800 x 2 for a different resolution) and set the form to the same point... the inside (right side) of the left screen on an extended desktop. Is there a way to tell how long the desktop is from left to right and top to bottom?
View 2 Repliesis it possible to choose different colors of different pixels on the background property of a form in vb.net?
i would like to clarify that i do not want to use an image to color the form.
i have a transparent form that will need to detect all the black colors behind it
This explains a lot why I was having much trouble determining the color of pixels. They are inverted!
Dim cursorpos As Point = Cursor.Position()
Dim hWnd As IntPtr = GetDesktopWindow()
Dim hDC As IntPtr = GetWindowDC(hWnd)
Dim i As Integer = GetPixel(hDC, cursorpos.x, cursorpos.Y)
Dim c As Color = Color.FromArgb(i)
ReleaseDC(hWnd, hDC)
Label6.Text = c.ToString
Label8.ForeColor = c
I am trying to determine the length of a string in pixels.
I created a little test program for myself and placed three labels on it, each with the same font in a different size. I set the width of the label to 1024, the screenwidth. I used the same test text for each label, cutting it off at the last character that shows, so there is not hidden text running off the label to be included in the string width count.
What I have found is that the width of the string is being reported as wider than the label, even though, as I just mentioned, there are no characters running off the edge of the label. So, something's awry. Does anyone know how to get an accurate width?
Here follows the whole test code. You can drop three labels on a form and run it to see what I mean.
Code:
Option Explicit On
Option Strict On
Public Class frmMain
[Code].....
how to generate combinations of pixels on a page using 24bit color using MS VB 10.0.
View 1 RepliesIs there a simple way to get the width and height of a picturebox in pixels?
View 3 RepliesMy goal is to iterate through each pixel determining whether it is black or white. Ideally I want to do this one row at a time (so I can count the number of black pixels in each row). This is a bitonal image.I tried to get it started, but I don't understand what value(s) I'm supposed to be polling for. The following code takes a stab at it (i.e. makes a guess as to what value I'm supposed to check) and then outputs that value to a textfile.When I read the textfile, though, it doesn't look like anything useful.This code is an attempted modification of some code found in a CodeProject article.[code]
View 5 RepliesI am looking to remove groups of pixels that are less than 10x10 in size. The pixels are generated from scanned fax reports and are solid black, so they should be able to weed out easily. Our fax machine is rather old, and it generates random block dots along our documents. In other words, I have several images with random solid black dots that need to be removed.
View 4 Replieswhat would be the fastest (best) way to make transparent all pixels in one image that are white on other image?
Let's say that have 2 transparent images (.png) and want to delete some portion of the first image. Pixels to be deleted (made transparent) are defined as white on the other image (some kind of deleting mask).
i mostly use C and assembly, but i thought i would give VB.NET a shot. i used to use VB6 all the time, so wanted to see how different this is. in VB2010, i'm trying to modify the pixels of a Bitmap object and then make it show up in a PictureBox on the form. i get no errors, but this code does not show the new bitmap after it runs.."disp" is the name of the PictureBox on the form.[code]
View 1 Replies