|
You should be able to do it with a single -crop command:
You can add the @ to the geometry argument to equally divide the image into the number of tiles generated.
convert -crop 120x120 LargeImage.jpg tiles/tile%03d.jpg
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Here's a link to the ImageMagick documentation for the crop command.
From a quick look it will do exactly what you want.
Link added: http://www.imagemagick.org/Usage/crop/[^]
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
modified 13-Jul-15 9:08am.
|
|
|
|
|
What link?
No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde
|
|
|
|
|
Sorry, I added the link!
Our office is out of coffee and I just came back from a three week vacation.
Now where's that switch to turn my brain back on?
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
I successfully create a custom cursor from a 32x32 32bpppArgb (GDI) Bitmap with the following code:
public static Cursor ToCursor(System.Drawing.Bitmap bmp, byte x, byte y)
{
var stream = new MemoryStream();
var hIcon = bmp.GetHicon();
try
{
System.Drawing.Icon.FromHandle(hIcon).Save(stream);
}
finally { NativeMethods.DestroyIcon(hIcon); }
stream.Seek(2, SeekOrigin.Begin);
stream.WriteByte(2);
stream.Seek(10, SeekOrigin.Begin);
stream.WriteByte(x);
stream.Seek(12, SeekOrigin.Begin);
stream.WriteByte(y);
stream.Seek(0, SeekOrigin.Begin);
return new Cursor(stream);
}
However the colors of my cursor are all wrong!
It looks like it is using a palette / a limited set of 16/32/256 colors?!
Is it possible to have 24bits/32bits colors cursor? (i.e. with millions of possible color value)
[EDIT] Solved!
I found a way to do it! With the following API in sequences:
GetHIcon() <br />
CreateIconIndirect() <br />
CursorInteropHelper<br />
There was just some nagging issue to avoid GDI Object leaks which I solved by creating a
class SafeIconHandle : SafeHandle
modified 4-Jun-15 20:19pm.
|
|
|
|
|
|
My cursor are created from code generated Bitmap, won't work!
Anyhow I found a way to do it! With the following API in sequences:
GetHIcon() <br />
CreateIconIndirect() <br />
CursorInteropHelper<br />
There was just some nagging issue to avoid GDI Object leaks which I solved by creating a
class SafeIconHandle : SafeHandle
|
|
|
|
|
You may want to look at Extended Cursors for .Net[^] as it has a whole bundle of features.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Thanks you!
Anyhow my problem was to make a cursor that like a zoomed version of the screen!! So it doesn't help!
But anyhow, all working by now!
|
|
|
|
|
I want to convert graphics such as rectangles, circles, etc. to truetype files. However, I can't write the geometry data for graphics to these truetype files.Is there have any code or tutorial to achieve this goal?
|
|
|
|
|
I am programming in C++. I have a lot of work that uses the GDI, GDI+ or the older canvas to display graphs and chart. I need to draw a 3D mesh surface using these tools. Is there any sample code using these draw tools?
|
|
|
|
|
Austin_Cpp wrote: Is there any sample code Quite probably, but you have to go and search for it.
|
|
|
|
|
I have searched quite a bit with no luck. Unfortunately GDI is not considered a good option for 3D programming and almost all the samples are in OpenGL or Direct3D. I really can't use OpenGL or Direct3D without major changes to my code. GDI+ almost feels obsolete with very little activity on code web sites.
|
|
|
|
|
hi, i am using c# and i have two color.
color p1, p2;
how do i compare if they are almost the same? as in like their color value with only very slight difference? should i compare the hue? with some threshold between the two.?
can anyone please advise.
|
|
|
|
|
I'm trying to import a terrain that I made in Blender by exporting it (from Blender) in .fbx format.
This model has only one modelmesh and Blender tells me in the top right hand corner that I have 16,384 verts which is correct since I divided my mesh into 128*128 equal parts.
I then imported my model into XNA using the Content pipeline and loaded it into a Model class.
I inserted a breakpoint on this line to "watch" the verticesIn.length property.
land.Meshes[0].MeshParts[0].VertexBuffer.GetData<VertexPositionNormalTexture>(verticesIn)
The verticesIn.length property was set to 54452, which is just over 3.3 times the number of vertices I'm meant to have as shown in Blender.
I'm using Blender v2.72 and XNA v4.0.
Any help will be greatly appreciated.
Kamran Kamal
|
|
|
|
|
I went through my model creation process again; saved and exported after each step and checked the number of vertices in XNA.
Everything appears fine until the deform modifier is applied in Blender.
As a work-around I decided to export my model after applying modifier. Importing the model into a new blender file, and then exporting the model. This worked!
Before doing this, I had tried exporting my model in .x format but this didn't make any difference.
I'm not sure if this problem exists with any modifier or just the deform modifer.
|
|
|
|
|
I'm doing quite a bit of graphics work that involves displaying material on a cartesian coordinate graph using GDI+ methods (DrawLine, DrawRectangle, etc) in the Paint routines of a PictureBox.
I'm always having to deal with scaling, rotation matrices and the other complications because the picturebox needs to have it's 'world' scaled rotated and translated before displaying normal Cartesian coords properly. Even with all this, it's always extra work to handle the fact that pens and some other graphics objects then draw their sizes transformed as well, and mouse events don't necessarily return points correctly.
Many years ago, I used TrueBasic and it had a drawing component that you could set up as simple as giving the width, height and everything transformed accordingly. I'm looking for a dotnet component that will give me a similiar object so I can stop having to customize the existing picturebox. Paid components are fine, but I have to be able to use GDI+ to draw in it or it must support something similiar. I do *not* want to use graphing/charting components that require the graphics objects/points to be stored in their own arrays or other unique systems. I want to do the drawing myself.
Any suggestions for a third party component?
|
|
|
|
|
please use System.Drawing namespace in your project.
where you find the Graphics class which will give you all option to Draw anything by using cartesian co-ordinate system.
for example..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace WaveformDemo
{
public partial class WaveDisplay : UserControl
{
[DefaultValue(10)]
int _XDivision; //Total X Division
[DefaultValue(10)]
int _YDivision;
[DefaultValue(10.0f)]//1 Volt per Division
float _voltsPerDivision;
[DefaultValue(10.0f)]//1 Sec per Division
float _timePerDivision;
[Browsable(true),DefaultValue(10)]
public int XDivisions
{
get
{
return _XDivision;
}
set
{
_XDivision = value;
}
}
[Browsable(true), DefaultValue(10)]
public int YDivisions
{
get
{
return _YDivision;
}
set
{
_YDivision = value;
}
}
[Browsable(true),DefaultValue(10.0f)]
public float VoltagePerDivision
{
get
{
return _voltsPerDivision;
}
set
{
_voltsPerDivision = value;
}
}
[Browsable(true), DefaultValue(10.0f)]
public float TimePerDivision
{
get
{
return _timePerDivision;
}
set
{
_timePerDivision = value;
}
}
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
public override ImageLayout BackgroundImageLayout
{
get
{
return base.BackgroundImageLayout;
}
set
{
base.BackgroundImageLayout = value;
}
}
public WaveDisplay()
{
InitializeComponent();
_voltsPerDivision = 10.0f;
_timePerDivision = 10.0f;
_XDivision = 10;
_YDivision = 10;
_s = new Sample();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
if (BackgroundImage != null)
{
g.DrawImage(BackgroundImage, ClientRectangle);
}
else
{
Brush b = null;
b = new SolidBrush(this.BackColor);
g.FillRectangle(b, this.ClientRectangle);
}
Pen pen = new Pen(ForeColor);
Rectangle r = new Rectangle(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Width, ClientRectangle.Height);
r.Inflate(new Size((int)(-ClientRectangle.Width * 0.1f),(int) (-ClientRectangle.Height * 0.1f)));
double xPixelPerDiv = (double)r.Width / (double)_XDivision;
double yPixelPerDiv = (double)r.Height /(double)_YDivision;
double TimePerUnit = _timePerDivision/_XDivision;
double VoltsPerUnit = _voltsPerDivision/_YDivision;
string s1 = null;
for (int i = 0; i <= _XDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left + xPixelPerDiv * i), r.Top),
new Point((int)(r.Left + xPixelPerDiv * i), r.Bottom));
s1 = (_timePerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF((int)(r.Left + xPixelPerDiv * i), r.Bottom + 10));
}
for (int i = 0; i <= _YDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left), (int)(r.Bottom - i * yPixelPerDiv)),
new Point((int)(r.Right), (int)(r.Bottom - i * yPixelPerDiv)));
s1 = (_voltsPerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF(r.Left - 15, (int)(r.Bottom - yPixelPerDiv * i)));
}
_s.Render(g,r,XDivisions*TimePerDivision);
//base.OnPaint(e);
}
Sample _s;
}
}
|
|
|
|
|
Thanks, I'm aware that the math can be done manually. I was hoping for a third-party component so I could focus my efforts elsewhere and not have to focus on writing code for the existing drawing components.
|
|
|
|
|
I've been searching for an answer, but I can't seem to find what I'm looking for.
Basically, I have a TTF font with some custom glyphs. I have successfully "painted" them on my OpenGL canvas (C# using Tao). My question is: is it possible to rotate the glyph (from 0-360 degrees)?
I need to be able to rotate the glyph depending on the heading data received - this way, the glyph is facing the correct direction.
If this is not possible, do you have any suggested alternatives? I've considered importing the glyph as an image and converting it to a bitmap - but I'm not sure if this will work either.
|
|
|
|
|
Good day friends. I have window 7 ultimate as my OS, and DX 11 is installed. Now, I want to install DX 8 or 9 but finding it difficult to do it. It refused to install. How can I do it?
|
|
|
|
|
Otekpo Emmanuel wrote: It refused to install. Meaning what?
|
|
|
|
|
I learnt from an article I read that dx11 can't be used with vb in ease way. So, the available tutorials are limited to dx 5, 6, 7, 8 and 9. And my system has dx11 installed. So, I wanted to un-install dx11 and replace it with dx 8 or 9 but is not successful because dx 1r is higher than 8 and 9. How can I do the replacement?
|
|
|
|
|
You need to uninstall DX11 and make sure that all associated registry keys are removed. You may need to check with Microsoft for more information on this.
|
|
|
|
|
Otekpo Emmanuel wrote: I learnt from an article I read that dx11 can't be used with vb in ease way Do you have any problems now? If not you should not care about something you have read somewhere.
You can try to install the DX9 runtime from http://www.microsoft.com/en-us/download/details.aspx?id=8109[^] or the SDK from http://www.microsoft.com/en-us/download/details.aspx?id=6812[^]. This should be possible because only missing parts will be installed and DX11 contains DX9. In fact the DX version that will be used depends on the capabilities of your graphics card. If your graphics card does not support DX10/11, DX9 will be used.
The runtime is used by most games and may be already installed if you have installed some games on your system. The SDK is only required if you want to use DX for your own programs (it includes the runtime).
From the above runtime download link:
Quote: The DirectX runtime cannot be uninstalled
So you should try to use your version first. If you really need a development system with an older DX version, you must setup one using an old Windows version.
|
|
|
|