# Vehicle Images

## You have two options:

### **Using Pre-Made Vehicle Images**

If you prefer using pre-existing images, you can download the resource from the following link:

🔗 [**BHD Vehicle Images Repository**](https://github.com/bohous04/bhd_vehicleimages)

Once downloaded, you can use it in your script like this:

```lua
local img = "nui:/bhd_vehicleimages/img/"..vehicleNameForIMG..".webp"
```

Alternatively, you can use the direct GitHub link:

```lua
local img = "https://raw.githubusercontent.com/bohous04/bhd_vehicleimages/refs/heads/main/img/"..vehicleNameForIMG..".webp"
```

***

### **Generating Your Own Vehicle Images**

If you prefer generating your own vehicle images, you need to use the **BHD Vehicle Screenshotter**. Follow these steps:

#### **Download the Screenshotter**

🔗 [**BHD Vehicle Screenshotter Repository**](https://github.com/bohous04/vehiclescreenshotter)

#### **Required Dependencies**

Before running the screenshotter, make sure you have installed the following dependencies:

* [rembg](https://github.com/danielgatis/rembg) – Background remover
* [ox\_lib](https://github.com/overextended/ox_lib) – FiveM Library
* [screenshot-basic](https://github.com/citizenfx/screenshot-basic) – Screenshot Utility
* [NodeJS](https://nodejs.org/) – JavaScript Runtime
* [pnpm](https://overextended.dev/guides/pnpm) – Package Manager

#### **Installing rembg**

1. Download the latest [**release version of rembg**](https://github.com/danielgatis/rembg/releases).
2. Install **rembg-cli-installer.exe**.
3. Open a **Windows Terminal** and run the following commands:

   ```sh
   pip install rembg
   pip install "rembg[cli]"
   ```

#### **Using the Screenshotter**

1. Start rembg in Windows Terminal:

   ```sh
   rembg s --host 0.0.0.0 --port 5000 --log_level info
   ```
2. Navigate to `src/server` and run:

   ```sh
   pnpm install & pnpm start
   ```
3. Enter FiveM and use one of the following commands:
   * `/screenvehicle <model name>` – Screenshots a specific vehicle.
   * `/screenCurrVeh` – Screenshots your current vehicle.
   * `/screenallvehicles` – Screenshots all vehicles (⚠️ **May cause game crashes**).
4. Find the output images in: `src/server/uploads`.

#### **Additional Notes**

* If using `/screenallvehicles`, your game **may crash** due to memory limitations. If this happens:
  1. Reconnect to the game.
  2. Use `/saveVehicles` to save the progress.
  3. Restart the script to avoid reprocessing already captured vehicles.
* If vehicles do not fit properly in the screenshot, edit the **`distanceMultiplier`** variable to adjust the framing.

***

This method allows you to have full control over the images used in your scripts. If you need any assistance, feel free to ask in the Discord support channels.
