Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GTA IMG Tool

Build and Test GitHub Release

A modern Windows application for viewing and editing IMG archive files from classic GTA games (GTA III, Vice City, San Andreas).

Screenshot

Download

Get the latest release from the Releases page.

Features

  • Open & Create Archives - Support for both VER1 (GTA III/VC) and VER2 (GTA SA) formats
  • Browse Files - View all entries with name, type, size, and offset information
  • Search & Filter - Quickly find files by name
  • Export Files - Export selected files or all files to any folder
  • Import Files - Add files individually, multiple at once, or from an entire folder
  • Replace & Rename - In-place replacement and renaming of entries
  • Delete Entries - Remove selected entries from the archive
  • Pack Archive - Defragment the archive to reclaim unused space
  • Drag & Drop - Drag IMG files onto the window to open them
  • Modern UI - Clean dark theme with custom title bar

Keyboard Shortcuts

Shortcut Action
Ctrl+N New Archive
Ctrl+O Open Archive
Ctrl+S Save Archive
Ctrl+W Close Archive
Ctrl+A Select All
Delete Delete Selected
F5 Refresh

Supported Formats

Format Games File Structure
VER1 GTA III, Vice City .dir + .img file pair
VER2 San Andreas Single .img file

For Developers

The underlying library GtaImg is also available as a NuGet package for developers who want to work with IMG archives programmatically.

NuGet

Installation

dotnet add package GtaImg

Or via Package Manager:

Install-Package GtaImg

Supported Frameworks

Framework Version
.NET Framework 4.5.2, 4.7.2, 4.8.1
.NET Standard 2.0
.NET Core 3.1
.NET 5.0, 6.0, 7.0, 8.0, 9.0, 10.0

Quick Start

using GtaImg;

// Open an archive
using var archive = new IMGArchive("gta3.img");

// List all entries
foreach (var entry in archive)
{
    Console.WriteLine($"{entry.Name} - {entry.SizeInBytes} bytes");
}

// Extract a file
archive.ExtractEntry("player.dff", @"C:\extracted\player.dff");

Read-Write Operations

using GtaImg;

// Open for editing
using var archive = new IMGArchive("gta3.img", IMGArchive.IMGMode.ReadWrite);

// Import a file
archive.ImportFile(@"C:\mods\custom.dff", "custom.dff");

// Remove an entry
archive.RemoveEntry("unwanted.dff");

// Rename an entry
archive.RenameEntry("old_name.txd", "new_name.txd");

// Save changes
archive.Sync();

Create New Archive

using GtaImg;

// Create a new VER2 archive
using var archive = IMGArchive.CreateArchive("new_archive.img", IMGArchive.IMGVersion.VER2);

// Add files
archive.ImportFile("mymodel.dff");
archive.ImportFile("mytexture.txd");

More Examples

Reading Entry Data
using GtaImg;

using var archive = new IMGArchive("gta3.img");

// Read by name
byte[]? data = archive.ReadEntryData("player.dff");

// Or use a stream
using var stream = archive.OpenEntry("player.dff");
if (stream != null)
{
    // Process stream...
}
Packing an Archive

After removing entries, the archive may have unused space. Use Pack() to defragment:

using GtaImg;

using var archive = new IMGArchive("gta3.img", IMGArchive.IMGMode.ReadWrite);

// Remove some entries
archive.RemoveEntry("file1.dff");
archive.RemoveEntry("file2.dff");

// Pack to eliminate holes
uint newSize = archive.Pack();
Console.WriteLine($"Archive size is now {newSize} blocks");
Detecting Archive Version
using GtaImg;

// Before opening
var version = IMGArchive.GuessIMGVersion("unknown.img");
Console.WriteLine(version == IMGArchive.IMGVersion.VER2 ? "GTA SA format" : "GTA 3/VC format");

// Or from an open archive
using var archive = new IMGArchive("unknown.img");
Console.WriteLine($"Archive version: {archive.Version}");

Building from Source

# Clone the repository
git clone https://github.com/vaibhavpandeyvpz/gtaimg.git
cd GtaImg

# Build everything
dotnet build

# Run the GUI tool
dotnet run --project src/GtaImgTool/GtaImgTool.csproj

# Run tests
dotnet test

Project Structure

├── src/
│   ├── GtaImg/           # Core library (NuGet package)
│   └── GtaImgTool/       # GUI application (WPF)
└── tests/
    └── GtaImg.Tests/     # Unit tests

License

This project is released under the MIT License.

Credits

This project is based on a C# port of the original C++ libgtaformats library by David "Alemarius Nexus" Lerch.

About

A modern Windows application for viewing and editing IMG archive files from classic GTA games (GTA III, Vice City, San Andreas).

Topics

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages