If you mean "resample the image to change the number of pixels" read what Image Magick is, it has a .net compatible object that does this using a list of params.
If you mean "scale an image in acad" (possibly unevenly too), I use this code:
//update ins pt, scale, and rotation
//copyFromFilename is when we want to copy and switch image from another
//for cases where oringinal image must be modified, and props will change
public static bool UpdateRasterProps(ObjectId id, string copyFromFilename, Point3d newBL, double width, double height, double newRot, bool noclip) {
bool ret = false;
//get object
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
using (DocumentLock doclock = doc.LockDocument()) {
using (Transaction tr = db.TransactionManager.StartTransaction()) {
DBObject obj = tr.GetObject(id, OpenMode.ForWrite);
// If image
AcDb.RasterImage raster = obj as AcDb.RasterImage;
if (raster != null) {
RasterImageDef rasterDef = tr.GetObject(raster.ImageDefId, OpenMode.ForWrite) as RasterImageDef;
if (copyFromFilename != "") {
rasterDef.Unload(false);
//copy image
File.Copy(copyFromFilename, rasterDef.SourceFileName, true);
rasterDef.Load();
File.Delete(copyFromFilename);
}
raster.Orientation = new CoordinateSystem3d(newBL, new Vector3d(width, 0.0, 0), new Vector3d(0.0, height, 0));
raster.Rotation = newRot;
if (noclip)
//raster.IsClipped = false; cant set in bricscad
raster.SetClipBoundaryToWholeImage(); //use this instead?
ret = true;
}
// Committing is cheaper than aborting
tr.Commit();
}
}
return ret;
}
Note that this code is made for eactly the case where you did want to modify the original, and also rescale in acad.
You cannot modify an image while reffed into acad. What I do is copy the orig, modify, then sub in using this. I basically made my own raster design set of tools using Image Magic and .net code. You are at the trailhead of a nice hike.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties