Coding of arbitrarily shaped image segments is an important tool to achieve object-based coding, which is becoming more and more popular in today's multimedia applications. We introduce a new padding technique based on which the arbitrarily shaped DCT can be implemented using a normal N/spl times/N DCT. The new padding is carried out for each arbitrarily shaped block in such a way that there are as many transformed coefficients of high frequencies as possible that could be set to zero. In the best case, it does not expand the data set in the DCT-domain. Arbitrarily shaped DCT coding based on this padding technique is developed, and then analyzed and compared against some of the existing algorithms in terms of the rate-distortion performance, computational complexity, and implementation cost.